我有一个带有 kendo UI 库的 Angular 5 应用程序。在此应用程序中,我有一个 Kendo UI 网格,其中包含一些行的详细信息。网格也是可排序的。 我想折叠当我单击列名称对数据进行排序时展开的所有详细信息。
这是我的 html 代码:
<kendo-grid
#grid
[kendoGridBinding]="getDataService().listOfSolution"
[resizable]="false"
[pageSize]="10"
[pageable]="true"
[sortable]="true"
[filterable]="false"
[groupable]="false"
[reorderable]="false"
[selectable]="false"
[scrollable]="'none'"
(dataStateChange)="onSort($event)"
[rowClass]="rowCallback()"
(detailCollapse)="onCollapse($event)"
(detailExpand)="onExpand($event)"
style="border: none;">
...
</kendo-grid>
但我找不到以编程方式关闭详细信息的方法。
你有什么想法吗?
最佳答案
您可以通过 collapseRow
函数折叠主行 ( API Reference )。
您可以在下面找到一个示例,说明如何解决您的特定用例。
@Component({ ... })
export class MyComponent {
onExpand(event) {
// keep track of all expanded rows (index)
}
onCollapse(event) {
// keep track of all expanded rows (index)
}
onSortChange(event) { // either (sortChange) or (dataStateChange)
// iterate all expanded rows & collapse them via `this.grid.collapseRow(index)`
}
}
关于angular - 在 Angular 应用程序中以编程方式折叠 Kendo UI 网格详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48909215/