I’m trying to reduce the rows in grid to only those that are selected, eliminating from the grid all that are not selected, a client-side operation.
The code below executes without error, but the grid.deleteRow(rowId); does nothing. I do not have an event attached that would effect this command (grid.attachEvent(“onBeforeRowDeleted”, doBeforeRowDeleted);).
I am aware that I can request a server-side operation to return only those rows that are selected. I’d prefer to not do this at this time.
Ideas, suggestions, please? Thanks!!!
function showSelectedRows() {
var ids = grid.getSelectedRowId()
if (ids){
var keep = false;
ids = ‘,’+ids.split(",")+’,’;
for (var i=0; i<grid.getRowsNum(); i++){
var rowId = ‘,’+grid.getRowId(i)+’,’;
keep = !(ids.search(rowId)===-1);
if(keep===false) { grid.deleteRow(rowId); }
}
grid.clearSelection();
}
}