As the subject says, I need to filter a grid based on user selected rows.
The following code does not work, but I don’t understand why.
function filter_grid()
{
var ids = mygrid.getSelectedRowId();
if(ids)
{
var selectedRows = ids.toString().split(',');
for(i=0; i<selectedRows.length;i++)
{
mygrid.filterBy(0, mygrid.cellById(selectedRows[i], 0).getValue(), (i==0?false:true));
}
}
else
{
mygrid.filterBy(0,"");
}
}
So, filterBy() is called with preserve=false for the first row, then true for subsequent rows, which the documentation suggests will allow me to filter by multiple values.
This ends up with no rows filtered (although it works for the very first selected row). If I reverse the value of preserve, the filter will only include the last selected row.
Seems like I’m missing something pretty basic here.
Thanks, Steve