Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Mar 03, 2009 21:11
open dhtmlx forum
dhtml grid

In ihis code my grid filter is too slow please help me for the grid filter fast . my grid have 50 data among 50 data when I search the data it take more time to filter the data . please

Give me reson why and also code for the filter to take few time for filter


div id="left123" style="float:left; width:275px">
<div id="Plan_flt_box" onclick="(arguments[0]||window.event).cancelBubble=true;" onkeyup="filterByCode()">


<input type="text" id="txtitinerarycode" />

</div>
<div id="22222"> Itenary Code :
itenary Name :<span style="position:relative;left:17px">
<input type="text" id="txtitineraryname" style="width: 148px" />
</span>

</div>
</div>
mygrid = new dhtmlXGridObject('gridbox');
var _js_prefix="../scripts/";
mygrid.setSkin("xp");
mygrid.init();
mygrid.enableAutoHeight(true);
mygrid.enableAutoWidth(true);//SearchItinerary
mygrid.imgURL=locationpath+'/Images/imgs/';
         mygrid.loadXML(locationpath+"/LoadData.aspx?ICode=All&PageName=SearchItinerary" +'&Mode='+strSaveMethod);
        
myDataProcessor = new dataProcessor(locationpath+"/SaveData.aspx?ICode="+reportId+"&PageName=Media");
    
    
     // mygrid.setOnRowDblClickedHandler(doOndblClick);
     myDataProcessor.setVerificator(1)
     myDataProcessor.setVerificator(3,checkIfNotZero)
     myDataProcessor.setUpdateMode("off");//available values: cell (default), row, off
     //mygrid.setOnKeyPressed(onKeyPressed);
     mygrid.setOnRowDblClickedHandler(doOndblClick);
     myDataProcessor.init(mygrid);
     mygrid.setSizes();
mygrid.attachEvent("onXLS",function() {



document.getElementById('rbanyone').disabled=true;
document.getElementById('rball').disabled=true;


//show loading message here
// document.getElementById('divWait').style.display="inline";

});


function filterByCode()
{


var tVal = document.getElementById('Plan_flt_box').childNodes[0].value.toLowerCase();
var aVal = "";//document.getElementById("Type_flt").childNodes[0].value.toLowerCase();

for(var i=0; i< mygrid.getRowsNum();i++)
{
var tStr = mygrid.cells2(i,1).getValue().toString().toLowerCase();
//var aStr = mygrid.cells2(i,6).getValue().toString().toLowerCase();
if((tVal=="" || tStr.indexOf(tVal)==0) && (aVal=="" || aStr.indexOf(aVal)==0))
mygrid.setRowHidden(mygrid.getRowId(i),false)
else
mygrid.setRowHidden(mygrid.getRowId(i),true)
}
}

Purushottam Dwivedi
Impossible Is Temporary

Answer posted by dhxSupport on Mar 04, 2009 01:08