我正在使用Kendo UI for Angular渲染表。该表工作正常,一切都显示出来。我的问题是,是否可以在初始行之前添加新的标题行,并可以在其中添加自定义值。
我当前用于渲染Kendo UI Grid表的代码如下所示。
我的组件
export class MyComponent implements OnInit, OnDestroy {
...
tableColumns = [
{ field: 'field1', title: 'title1', width: 80},
{ field: 'field2', title: 'title2', width: 180 },
{ field: 'field3', title: 'title3', width: 100 },
{ field: 'field4', title: 'title4', width: 80 },
{ field: 'field5', title: 'title5', width: 400 },
{ field: 'field6', title: 'title6', width: 80 },
{ field: 'field7', title: 'title7', width: 60 },
{ field: 'field8', title: 'title8', width: 90 },
{ field: 'field9', title: 'title9', width: 100 }
];
view: Observable<GridDataResult>;
state: State = {
skip: 0,
take: 10,
sort: [{dir: "desc", field: "field1"}]
};
public dataStateChange(state: DataStateChangeEvent): void {
this.state = state;
this.view = this.myService.getAll('my-endpoint', this.state);
}
...
my-component.ts
<kendo-grid
[data]="view | async"
[pageable]="true"
[pageSize]="state.take"
[skip]="state.skip"
[sort]="state.sort"
[sortable]="true"
[loading]="worklistService.isLoading"
(dataStateChange)="dataStateChange($event)">
<kendo-grid-column
*ngFor="let tableColumn of tableColumns"
[field]="tableColumn.field"
[title]="tableColumn.title"
[width]="tableColumn.width">
</kendo-grid-column>
</kendo-grid>