reduce grid rows to those selected

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 = !(;
if(keep===false) { grid.deleteRow(rowId); }

By adding commas, you have corrupted the original id, that is why delete row has not effect

just replace
if(keep===false) { grid.deleteRow(rowId); }
if(keep===false) { grid.deleteRow(grid.getRowId(i)); }