Categories | Question details Back To List | ||
Perfomance Issue in Filters I have a grid with more than 1000 rows.I applied a filter to one of the fields "project" in the header.When i enter a name in the filter text box, it is taking more time to display the row.Sometimes the screen is strucked and it ended with killing the process of the screen. Is there any way to improve the performance of filter for the larger grid.Here is the peice of code i used function filterBy(mygrid3, elementId, colNum){ //alert("Called"); var tVal = document.getElementById(elementId).childNodes[0].value.toLowerCase(); //tVal = document.getElementById(elementId).childNodes[0].selectedItem(); //alert("tVal = " + tVal); mygrid3.expandAll(); for(var i=0; i< mygrid3.getRowsNum();i++) { var tStr = mygrid3.cells2(i,colNum).getValue().toString().toLowerCase(); if(tVal=="" || tStr.indexOf(tVal)==0){ mygrid3.setRowHidden(mygrid3.getRowId(i),false); checkId = mygrid3.getRowId(i); while (mygrid3.getLevel(checkId) > 0){ mygrid3.setRowHidden(mygrid3.getParentId(checkId),false); checkId = mygrid3.getParentId(checkId); } } else{ mygrid3.setRowHidden(mygrid3.getRowId(i),true); } } } Please help me on this. Answer posted on Aug 13, 2008 01:53 Starting from grid 1.5 , there is buile in filtering functionality which works much more faster than custom solutions. http://dhtmlx.com/docs/products/dhtmlxGrid/samples/filtering/?un=1218618818000 grid.filterBy(colNum,function(val){ if (val=="" || val.indexOf(tVal)==0) return true; return false; }) Starting from dhtmlxgrid 1.6 it can be used against treegrid as well http://dhtmlx.com/docs/products/dhtmlxTreeGrid/samples/grid_operations/treegrid_filtering.html?un=1218618789000 |