要禁用AG-Grid Angular中的loadingCellRenderer,您可以使用自定义的cellRenderer来替代它。以下是一个示例代码:
import { Component } from '@angular/core';
@Component({
selector: 'app-custom-cell-renderer',
template: `
{{ value }}
`
})
export class CustomCellRendererComponent {
value: any;
agInit(params: any): void {
this.value = params.value;
}
}
import { Component } from '@angular/core';
import { CustomCellRendererComponent } from './custom-cell-renderer.component';
@Component({
selector: 'app-grid',
template: `
`
})
export class GridComponent {
rowData: any[];
columnDefs: any[];
constructor() {
this.rowData = [
{ name: 'John', age: 25 },
{ name: 'Jane', age: 30 },
{ name: 'Bob', age: 35 }
];
this.columnDefs = [
{ headerName: 'Name', field: 'name' },
{ headerName: 'Age', field: 'age', cellRendererFramework: CustomCellRendererComponent }
];
}
}
在上述代码中,我们使用CustomCellRendererComponent作为Age列的cellRenderer。CustomCellRendererComponent简单地显示传递给它的值。
这样,AG-Grid Angular将不再使用loadingCellRenderer,并且使用自定义的cellRenderer来显示数据。