单击过滤器后,出现此错误:
错误TypeError:无法在UserComponentFactory.push ../ node_modules / ag-grid-community / dist / lib / components / framework / userComponentFactory.js.UserComponentFactory.lookupComponentClassDef
上读取null的属性'componentFromFramework'
如何解决此错误?
HTML:
<ag-grid-angular #agGrid id="myGrid" class="ag-theme-balham"
[columnDefs]="columnDefs"
rowSelection="multiple"
[frameworkComponents]="frameworkComponents"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
[paginationPageSize]="30"
[pagination]="true"
[suppressDragLeaveHidesColumns]="true"
[headerHeight]="headerHeight"
[defaultColDef]="defaultColDef"
>
</ag-grid-angular>
单击过滤器field: 'hasPermission',
后出现错误
组件:
export class ListComponent implements OnInit {
columnDefs: any;
defaultColDef: any;
rowData: any;
gridApi?: any;
gridColumnApi: any;
frameworkComponents: any;
headerHeight: any;
lockSelectedNodes: DataUser[] = [];
gridOptions: any;
constructor( public dataService: DataService) {}
onGridReady(params: any) {
this.gridApi = params.api;
this.gridColumnApi = params.columnApi;
}
ngOnInit() {
this.dataService.listUsers().subscribe(listUsers => {
this.rowData = listUsers;
});
this.frameworkComponents = {
selectComponent: CheckedSelectComponent,
};
this.columnDefs = [{
headerName: '',
colId: 'id_',
field: 'id_',
width: 80,
headerCheckboxSelection: true,
checkboxSelection: true,
headerComponentParams: {hideSort: true},
editable: true,
filter: 'selectComponent',
sortable: false,
},{
headerName: 'Value', colId: 'value', field: 'value', sortable: true, resizable: true, filter: 'agTextColumnFilter',
filterParams: {
clearButton: true
},
width: 150
}, {
headerName: 'Has permission?',
colId: 'hasPermission',
field: 'hasPermission',
filter: 'agSetColumnFilter',
filterParams: {
},
width: 270,
cellRenderer: (params: any) => {
if (params.data.hasPermission === true) {
return 'Yes';
}
return 'No';
}
}];
this.headerHeight = 50;
this.defaultColDef = { filter: true };
}
}
我应该安装图书馆吗?