I try to create a custom angular kendo grid component. Some columns should be created from ContentChildren
some classic *ngFor. It's need because some columns it's sample and get from config file. Some page we have column with functionality, example check box.
Like this
<kendo-grid
[data]="dataResult"
[pageSize]="state.take"
[skip]="state.skip"
[sort]="state.sort"
[filter]="state.filter"
[sortable]="true"
[loading]="loading"
[pageable]="true"
(dataStateChange)="onDataStateChange($event)"
>
<ng-template ngFor let-column [ngForOf]="columns">
<ng-container [ngTemplateOutlet]="column"></ng-container>
</ng-template>
<kendo-grid-column
*ngFor="let field of options.fields"
[field]="field.id"
[title]="field.columnName"
[width]="field.width"
></kendo-grid-column>
</kendo-grid>
export class GridComponent implements AfterContentChecked {
@Input()
data: any[] = [];
@Input()
filters: FilterDescriptor[] = [];
@Input()
sorts: SortDescriptor[] = [];
@Input()
options: Report = {};
@ContentChildren(ColumnComponent)
columns: QueryList<ColumnComponent>;
dataResult: DataResult;
state: State;
loading: boolean;
constructor() {
this.state = {
take: 10,
skip: 0,
filter: {
logic: 'and',
filters: this.filters
},
sort: this.sorts
};
}
ngAfterContentChecked(): void {}
ngOnInit(): void {}
onDataStateChange(state: DataStateChangeEvent): void {
this.state = state;
}
}
It's possible? Because I get error
TypeError: templateRef.createEmbeddedView is not a function
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…