简体   繁体   English

在Angular-Slickgrid中默认选中或选中所有行复选框和header行复选框

[英]Keep all row checkboxes & header row checkbox selected or checked by default in Angular-Slickgrid

I am using Angular SLickgrid and want to show all the checkboxes for all rows & also header row checkbox as selected by default (when grid loads).我正在使用 Angular SLickgrid 并希望显示所有行的所有复选框以及默认选中的 header 行复选框(当网格加载时)。 I am able to achieve it partly by using this.angularGrid.gridService.setSelectedRows(this.allDataId) but I am getting errors in console and all data rows are not visible.我可以通过使用this.angularGrid.gridService.setSelectedRows(this.allDataId)部分实现它,但我在控制台中遇到错误并且所有数据行都不可见。 I cannot use preset because I want to show all rows selected & till the time angular grid is loaded, I don't have all row IDs.我不能使用预设,因为我想显示所有选定的行,直到加载 angular 网格时,我没有所有行 ID。 Below is the error that I am getting.下面是我得到的错误。 I have added null checks before passing data to setSelectedRows() but no use.在将数据传递给setSelectedRows()之前,我添加了 null 检查,但没有用。

TypeError: Cannot read property 'children' of null
    at ensureCellNodesInRowsCache (dist/data.bundle.js.gz:2692)
    at getCellNode (dist/data.bundle.js.gz:2692)
    at updateCellCssStylesOnRenderedRows (dist/data.bundle.js.gz:2692)
    at setCellCssStyles (/dist/data.bundle.js.gz:2692)
    at Event.handleSelectedRangesChanged (/dist/data.bundle.js.gz:2692)
    at Event.notify (/dist/data.bundle.js.gz:2674)
    at RowSelectionModel.p [as setSelectedRanges] (/dist/data.bundle.js.gz:2692)
    at SlickGrid.setSelectedRows (/dist/data.bundle.js.gz:2692)
    at SlickGrid.m (/dist/data.bundle.js.gz:2692)
    at Event.notify (/dist/data.bundle.js.gz:2674)

Please suggest how to achieve it.请建议如何实现它。 Thanks.谢谢。

The answer, if that is an acceptable one, is in your question.答案,如果这是一个可以接受的答案,就在你的问题中。 The SlickGrid Row Selection plugin is not meant to be all selected at first so you have to stick with using setSelectedRows and if you don't have all Ids at hand then call it when you do... and in case you're pushing data in chunk, then call setSelectedRows on each chunk. SlickGrid 行选择插件并不意味着一开始就被全部选中,所以你必须坚持使用setSelectedRows ,如果你手头没有所有 Id,那么当你这样做时调用它......如果你正在推送数据在块中,然后在每个块上调用setSelectedRows There's no magic here, you need to call it when you have the correct Ids这里没有魔法,当你有正确的 ID 时你需要调用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使将 enableHeaderMenu 选项设置为 true,Angular-Slickgrid 标题菜单也不可见 - Angular-Slickgrid header menu is not visible even setting enableHeaderMenu option to true 在ui-grid上选择所有事件时选择组级别行 - Selecting group level row on selecting all event on ui-grid AngularJs - 如何获取点击行的单元格数据 - AngularJs - How to get cell data of clicked row angular 来自 html 文件的通用 UI 显示复选框 - angular generic ui display checkbox from html file 使用row和col值angularjs对齐gridster项目 - Align gridster items using row and col values angularjs 更新行顺序后如何验证Angular网格的第一行? - How to verify the first row of an Angular grid after updating the order of the rows? 如何让 angular-grid 监听行取消选择事件 - How to get angular-grid to listen to a row deselect event 如果标题超出屏幕宽度,如何在 Protractor 测试中验证 Angular Grid 的所有列标题? - How to validate all column headers of Angular Grid in Protractor test if headers span past the width of the screen? 如何扩展 Angular 材料选项卡以显示 Angular 网格数据? - How to expand Angular Material Tab to show Angular Grid data? 想要访问 angular 中的数组索引 - Want to access index of array in angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM