How do I load a filtered dhtmlxGrid?

Hi,

I have a dhtmlxgrid with a column (7) containing data with number format.

[i]MyGrid.init();
MyGrid.load(“fornitor.php”);
MyGrid.filterBy(7,‘2’);

… function mypersonfilter(index) { MyGrid.filterBy(7,index); };[/i]

  1. How can I perform a filter during the initial load?
    Now even if I put filterby, I upload the entire grid.
    There is an event type as soon as afterload the grid …

  2. when I run the function in dhtmlxGrid find other values ​​as filter if I’ll get 2 12 20 21 22 …

thanks
Samuele

Try putting the filter statement as a function of load:

docs.dhtmlx.com/doku.php?id=dhtm … bject_load

Like:

MyGrid.load("fornitor.php",  function(){ MyGrid.filterBy(7,'2'); }   );

This way the filerBy is executed as soon as the rows are loaded.

Thank you, a very good solution but

it shows me all the records that contain the number 2 as the 12, 20,21,22,23,24,25,26, etc…

Please, try to use

mygrid.load("fornitor.php", function(){ mygrid.filterBy(7,function(data){ return data.toString()=="2"; }) });