Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by lalit gera on Jul 02, 2009 07:10
open dhtmlx forum
dhtmlxgrid with inbuild filter

hi,
i am using dhtmlxgrid with filters in header as :

me.mygrid4.setImagePath("../dhtmlx/dhtmlxGrid/codebase/imgs/");
me.mygrid4.setHeader("IPAddress,NodeName,Time,Description");
me.mygrid4.setColAlign("center,center,center,left");
me.mygrid4.attachHeader("#select_filter_strict,#select_filter_strict,#select_filter_strict,#select_filter_strict");
me.mygrid4.setInitWidths("130,130,130,400");
me.mygrid4.setColTypes("ro,ro,,ro,ro");
me.mygrid4.setColSorting("str,str,str,str");
me.mygrid4.setSkin("light");
me.mygrid4.init();
me.mygrid4.setColumnHidden (5,true);

i am doing auto refresh as :

function autoRefreshAlarms() {
    ---------------
    genInfo.init();
    ---------------
    setTimeout ('autoRefreshAlarms ()', 5000);

}


aaaa.prototype.init = function () {

-- --------------------
-------------------------
me.mygrid.clearAll(false);
me.mygrid.loadXMLString(alarmString);
me.mygrid.refreshFilters ();
-----------------------
---------------------
}
My problem :
when i am filtering by ip address say 10.11.11.11, grid is filtered for ip-address 10.11.11.11 , but when auto-refresh is called filter got cleared , and grid shows whole data (with all ips).
is there any way to set filter on some value and after loading grid with whole value it should show only filter (ip = 10.11.11.11) value.
Answer posted by dhxSupport on Jul 02, 2009 07:53
After loading new items in grid you can filter it using mygrid.filterByAll() method
aaaa.prototype.init = function () { 

-- -------------------- 
------------------------- 
me.mygrid.clearAll(false); 
me.mygrid.loadXMLString(alarmString); 
me.mygrid.refreshFilters (); 
me.mygrid.getFilterElement(0).value="10.11.11.11";
me.mygrid.filterByAll();
----------------------- 
--------------------- 
}