[英]How to set selected row programmatically in Kendo Grid + Angular 4?
[英]Is it possible to set row numbers in the kendo angular grid?
我正在使用劍道 angular 網格來顯示我的數據。 但我需要在每一行都有一個RowNumber
。 我搜索但沒有找到任何解決方案。 是否可以設置行號?
這是我的代碼:
@Component({
selector: 'my-app',
template: `
<kendo-grid [data]="gridData" [height]="410">
<kendo-grid-column field="ProductID" title="ID" width="40">
</kendo-grid-column>
<kendo-grid-column field="ProductName" title="Name" width="250">
</kendo-grid-column>
<kendo-grid-column field="Category.CategoryName" title="Category">
</kendo-grid-column>
<kendo-grid-column field="UnitPrice" title="Price" width="80">
</kendo-grid-column>
<kendo-grid-column field="UnitsInStock" title="In stock" width="80">
</kendo-grid-column>
<kendo-grid-column field="Discontinued" title="Discontinued" width="120">
<ng-template kendoGridCellTemplate let-dataItem>
<input type="checkbox" [checked]="dataItem.Discontinued" disabled/>
</ng-template>
</kendo-grid-column>
</kendo-grid>
`
})
export class AppComponent {
public gridData: any[] = products;
}
您可以添加這樣的列:
<kendo-grid-column >
<ng-template kendoGridCellTemplate let-rowIndex="rowIndex">
{{rowIndex}}
</ng-template>
</kendo-grid-column>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.