I have used the api function and works as expected:
mygrid.setColumnHidden(idx,true);
I have paginal output that interrogates the hidden column on every page. I have therefore implemented the following callback on a page change:
mygrid.setOnPageChanged(function(pageNo){
mygrid.forEachRow(function(id){
cellValue = mygrid.cells(id,10).getValue();
if (cellValue == “someValue”){
mygrid.setRowColor(id,"#FFAFBA");
}
});
});
The forEachRow function always starts at the first row of the first page. In other words when on page 1 it loops through the rows on page 1. When on page 2 it loops through the rows on page 1 and 2. When on page 3 it loops through pages 1,2 and 3 etc. This seems inefficient for my purposes. Is there a way to interrogate only the rows of the page that the client is on? Somehow passing in a start and end row identifier?
Thanks
George
Classic iterator
for (var i=0; i<grid.getRowsCount(); i++){This way of iteration has the following characteristics:
// here i - index of row in grid
do_something_with_row(index);
}
- Used parameter - index (not ID), zero based position of a row in the grid;
- The order of iteration equals the order of elements in the grid;
- In case of paging mode - only current page is iterated;
- In case of tree grid - only currently visible rows are iterated;
- In case of smart rendering mode - not usable;
- In case of applied filtering - only rows that accept filtering rules will be included in iteration.
Built-in iterator
grid.forEachRow(function(id){This way of iteration has the following characteristics:
// here id - row ID
do_something_with_row(id);
})
- Used parameter - row ID;
- Order
of iteration is not equal to the current rows order in grid (basically
it is equal to the adding order of rows to the grid, but it can be
inconsistent); - In case of paging or smart rendering mode - all rows parsed at the current moment will be affected;
- In case of tree grid - all rows will be processed, including those in closed branches;
- In case of applied filtering - all rows in the grid (including filtered out ones) will be included in iteration.
So you can use
for (var i=0; i<grid.rowsCol.length; i++){
do_something_with_row(index);
}