I am using mleibman/SlickGrid and have checkbox (isChecked) column,
(我正在使用mleibman / SlickGrid并具有复选框(isChecked)列,)
var columns = [
{ id: "tagID", name: "#", field: "tagID", behavior: "select", cssClass: "cell-selection", width: 40, cannotTriggerInsert: true, resizable: false, selectable: false, excludeFromColumnPicker: true },
{ id: "isChecked", name: "isChecked", field: "isChecked", width: 80, minWidth: 20, maxWidth: 80, cssClass: "slick-cell-check", formatter: Slick.Formatters.Checkbox, editor: Slick.Editors.Checkbox, sortable: true },
{ id: "tagName", name: "tagName", field: "tagName", width: 90, minWidth: 120, cssClass: "cell-title", sortable: true },
{ id: "description", name: "description", field: "description", width: 120, minWidth: 120, cssClass: "cell-title", sortable: true }
];
How to get all selected/checked rows.
(如何获取所有选中/选中的行。)
My Approach: (我的方法:)
function GetCheckedRows() {
var checkedRows = [];
for (var i = 0; i < grid.getDataLength(); i++) {
if (grid.getDataItem(i).isChecked
checkedRows.push(grid.getDataItem(i));
}
console.log(checkedRows);
}
Calling GetCheckedRows never returns first checked row, second checked row comes and deselecting doesn't removes from checkedRows.
(调用GetCheckedRows永远不会返回第一个选中的行,第二个选中的行会出现,并且取消选择不会从checkedRows中删除。)
ask by Kumar Gaurav translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…