gpt4 book ai didi

javascript - Angular ag-grid : "Could not find component class XXX, did you forget to configure this component" 出错

转载 作者:行者123 更新时间:2023-12-05 00:43:58 25 4
gpt4 key购买 nike

运行 ag-grid 应用程序时,我从 Chrome 收到此错误。基本上,我有以下

export class CustomHeader implements IHeaderAngularComp {
private params: any;


@ViewChild('menuButton', { read: ElementRef }) public menuButton;

agInit(params): void {
this.params = params;
}

onMenuClicked() {
this.params.showColumnMenu(this.menuButton.nativeElement);
}

refresh(params: IHeaderParams): boolean {
return true;
}
}

...

ColumnDefs = {
...
{
field: "A column", editable: false, sortable: false, width: 90,
type: 'stringColumn', centered: true, pinned: 'left',
headerComponent: CustomHeader,
headerComponentParams: {
template: `
<div ref="eLabel" class="lmn-form-group">
<input ref="eCheck" type="checkbox">
<span>Use This</span>
</div>
`
}
},
...
}

Chrome 说它无法识别这个 CustomHeader:

Could not find component class CustomHeader {agInit(params) {this.params = params;}onMenuClicked() {this.params.showColumnMenu(this.menuButton.nativeElement);}refresh(params) {return true;}}, did you forget to configure this component?"

我有什么遗漏吗?

最佳答案

你见过example in the documentation ?

请注意,您还需要提供 [frameworkComponents] 网格属性,以便网格知道使用标题组件:

 this.frameworkComponents = { agColumnHeader: CustomHeader };

关于javascript - Angular ag-grid : "Could not find component class XXX, did you forget to configure this component" 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68569325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com