I am using mleibman/SlickGrid and have checkbox (isChecked) column,
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.
For a start use 6pac SlickGrid , the MLeibman repo is dead now.
Are you missing a closing ')' in the line
if (grid.getDataItem(i).isChecked
or is this just a typo in what you've posted?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.