【问题标题】:Kendo Grid Angular (kendo-angular-grid@^1.4.1)Kendo Grid Angular (kendo-angular-grid@^1.4.1)
【发布时间】:2018-03-08 16:56:05
【问题描述】:

目前,我想选择 Kendo Grid 中的第一行。这是我的代码: 在组件中:

export class SampleComponent{  
  gridView: GridDataResult; 
  mySelection: number[] = [0]; 
  state: State = { skip: 0, take: 6, sort: [{ dir: "desc", field: "id" }]};
  ...  
}

在 HTML 中:

<kendo-grid id="grid" 
   [data]="gridView" [pageSize]="state.take" 
   [skip]="state.skip" [selectable]="true" 
   (selectionChange)="onSelect($event)" 
   (sortChange)="sortChange($event)" 
   [sort]="state.sort" [filter]="state.filter" 
   [sortable]="true" [kendoGridSelectBy]="'id'" 
   [selectedKeys]="mySelection" [height]="'auto'" [scrollable]="'none'">

我的问题是: Grid 的第一行没有被选中。我该如何解决它?

请帮帮我。

【问题讨论】:

  • 更新 html:

标签: angular kendo-ui-angular2


【解决方案1】:

听起来您想按 rowIndex 进行选择,但您正在向 [kendGridSelectBy] 提供一个键 ('id'),覆盖默认值。

改变

    [kendoGridSelectBy]="'id'" 

    kendoGridSelectBy

它应该选择

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-20
    • 2018-07-29
    • 2023-03-21
    • 2017-07-23
    • 2018-03-12
    • 2018-12-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多