Hide show rows

Hello,



Is its possible to hide and show rows in the same way a s columns. I can’t see anything about that in the documentation.



We have a series of filters which work fine, the result of the filter populates a multiple select box. We want to the use this to then give the user the option to narrow down the choice further by selecting a subset from this list click filter then filter the grid according to this selection.



The ID’s of the select are the same as the ID’s of the rows so I can just loop thourgh and hide the ones that are not selected but can’t find a function to hise a row?



Many thanks

Scott Bailey

Row can be hidden by
grid.setRowHidden(id,true);
and show back by
grid.setRowHidden(id,false);

>>so I can just loop thourgh and hide the ones that are not selected but can’t find a function to hise a row
Please beware that setRowHidden is relative slow operation, built in filtering ( grid.filterBy ) is much faster approach in most cases


Many thanks,



I cannot filter the last bit - the grid will already be filtered on various cloumns then I need to chhoose certain rows from that filtered grid. Unless there is a way to filter one column with various criteria e.g. filter column a if it contains texta or textb or textc? That would be a much better way of doing it.

I need to chhoose certain rows from that filtered grid
The 3rd parameter of filterBy control such behavior, if it set to true - filter will be run agains already filtered dataset, without reseting it to initial state.

>>if it contains texta or textb or textc
mygrid.filterBy(1,function(val){
return (val == “texta” || val == “textb” || val == “textc”);
})




Hello,



That might help to filter by multiple values.



mygrid.filterBy(1,function(val){
     return (val == “texta” || val == “textb” || val == “textc”);
})




Can i put a function in this bit? return (val == “texta” || val == “textb” || val == “textc”);
 as the values are helld in a javascript array and I would need to loop through and say for each l val==selectedValu[1] for example? Or say val is in array?



 



Scott

You can use any code inside function used as parameter of filterBy
The logic of actions is next

Component will call function for each row in grid and will provide value of cell as incoming parameter , if function returns true - row will accepted, if function returns false - row will be rejected.
The code inside function may contain any necessary logic, while it returns true or false values.

mygrid.filterBy(1,function(val){
for (var i=0; i<some.length; i++)
if (some[i]==val) return true;
return false;
})


Many thanks!



That reslved it and I understand how it works for future now.