Getting all rows when paged and filtering

I have a grid that is using paging and also using filtering. One of my columns contains checkboxes. I would like to get all of the cells that have the checkbox checked and that includes the cells that are not being displayed because of the filter. I can’t find an API that will get me all of the rows in the grid. The getCheckedRows(…) will not include the rows that have been filtered out. The forEachRow(…) API will only include rows that have actually been rendered, so if I don’t don’t page through all of the pages first, it won’t include those rows. I’ve tried getAllRowsIds() and then looping through that list, but it does not include the fitered out rows. I’ve also tried getRowsNum() and looping through that, but that does not work either because rows are missing.

How do I do this? I just want a way to get all of the cells that contain a checked checkbox for a given column, whether or not the contained row is visible due to filtering of paging.

You can use getRowsNum() method:

for (var i=0; i<grid.getRowsNum()-1; i++){ var id=grid.getRowId(i); var checked=grid.cellById(id).isChecked(); }

I tried something very similiar to that, but it did not include the rows that were filtered out.

var rowCount = aclGrid.getRowsNum();
for (var i=0; i < rowCount; i++) {
    var id = aclGrid.getRowId(i);
    for (var j=3; j < 8; j++) {
        if (aclGrid.cells(id, j).getValue() != 0) {
            ...
        }
    }
}

This is only counting the number of rows that are visible due to the filter. It is not including all rows in the grid. I have 160 rows in the grid. When I filter one of the column, the value returned by getRowsNum() only includes the number of rows that resulted from the filter. I want everything really contained by the grid.

According to the documentation:

mygrid.forEachRow(function(id) { mygrid.CellById(row_id,0).setValue(id); //id - the row id });

Using forEachRow, if you apply filtering to the grid, all the rows will be iterated, no matter if they meet filtering criteria or not;

docs.dhtmlx.com/grid__iterators.html

1 Like