I have a grid with 1500 rows or so, to make the search in the field the process is too slow, and could improve the search? my code:
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath(“codebase/imgs/”);
mygrid.setHeader(“Codigo Repuesto, Descripcion, Cantidad, Lote”);
mygrid.setInitWidths(“100,360,60,80”);
mygrid.setColAlign(“right,right,right,right”);
mygrid.setColTypes(“ro,ro,ed,ed”);
mygrid.setSkin(“dhx_skyblue”);
mygrid.getCombo(5).put(2, 2);
mygrid.setColSorting(“int,str,int,str”);
mygrid.setColumnColor(“white,#ceeecb,white,#ceeecb”);
//mygrid.setColumnMinWidth(50,200,50);
mygrid.attachEvent(“onRowSelect”, doOnRowSelected);
mygrid.attachEvent(“onEditCell”, doOnCellEdit);
mygrid.init();
mygrid.enableSmartRendering(true);
mygrid.loadXML("…/…/js/php/carga.php", function() {
mygrid.attachHeader("
//set title filter field;
document.getElementById(“buscaR”).appendChild(document.getElementById(“repuesto”).childNodes[0]);
//set author fiter field;
document.getElementById(“buscaD”).appendChild(document.getElementById(“descripcion”).childNodes[0]);
// Esto es para lista desplegable opciones de busqueda por agrupacion y concidencia
/* var authFlt = document.getElementById(“buscaD”).appendChild(document.getElementById(“descripcion”).childNodes[0]);
populateSelectWithAuthors(authFlt); */
//block sorting and resize actions for second row;
mygrid.hdr.rows[2].onmousedown = mygrid.hdr.rows[2].onclick = function(e) { (e || event).cancelBubble = true;
}
mygrid.setSizes();
});
myDataProcessor = new dataProcessor("../../js/php/graba.php");
myDataProcessor.init(mygrid);
//myDataPocessor.enableDebug(true);
}
function filterBy() {
var tVal = document.getElementById(“buscaR”).childNodes[0].value.toLowerCase();
var aVal = document.getElementById(“buscaD”).childNodes[0].value.toLowerCase();
for (var i = 0; i < mygrid.getRowsNum(); i++) {
var tStr = mygrid.cells2(i, 0).getValue().toString().toLowerCase();
var aStr = mygrid.cells2(i, 1).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);
}
}
}