Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by hony on Sep 11, 2009 08:17
open dhtmlx forum
drag -n-drop and filter problem

hi. this is the drag -n-drop and filter problem

at first i dont make enableSmartRendering turn on,so filter 300 data is too slow ,then i turn it on , i find that filter data is very fast ,but when i get 1000 data and drag one data  from mygrid1  drop to mygrid2,i find it begin slow.

how to make it fast? can you tell me some to try?  bellow is my code.  thanks.   

 mygrid1 = new dhtmlXGridObject('gridbox1');
  mygrid1.setImagePath("imgs/xdhtml/");
  mygrid1.setHeader("awbNo,awbStatus,awbDate,awbFrom,awbTo,awbArrive,awbName,awbNumber,awbBy,awbFor");
  mygrid1.setInitWidths(90 + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width); 
  mygrid1.setColAlign("center,center,right,right,right,right,right,right,right,right");
  mygrid1.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
  mygrid1.setColSorting("int,str,str,str,str,str,str,str,str,str")
  mygrid1.enableEditEvents(false, false, true);   
  mygrid1.enableDragAndDrop(false);mygrid1.setOnRowDblClickedHandler(leftMove); 
  mygrid1.init(); 
  mygrid1.setSkin("light");

 

mygrid2 = new dhtmlXGridObject('gridbox2');
  mygrid2.setImagePath("imgs/xdhtml/");
  mygrid2.setHeader("awbNo,awbStatus,awbDate,awbFrom,awbTo,awbArrive,awbName,awbNumber,awbBy,awbFor");
  mygrid2.setInitWidths(90 + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width + "," + width); 
  mygrid2.setColAlign("center,center,right,right,right,right,right,right,right,right");
  mygrid2.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
  mygrid2.setColSorting("int,str,str,str,str,str,str,str,str,str")
  mygrid2.enableEditEvents(false, false, true);   
  mygrid2.attachHeader("#text_filter,-,-,-,-,-,-,-,-,-");
  mygrid2.enableDragAndDrop(false);
  mygrid2.init(); 
  mygrid2.setSkin("light");
  mygrid2.enableSmartRendering(true);  
  mygrid2.setAwaitedRowHeight(20);
  mygrid2.setOnRowDblClickedHandler(rightMove); 
        if("${resultXml}"!="null" && "${resultXml}"!=""){   
           mygrid2.loadXMLString("${resultXml}");            
        }

function rightMove() {
        var mid = mygrid2.getSelectedRowId();
        mygrid2.filterBy(0);
        if(!mygrid1.doesRowExist(mid)){
        mygrid2.moveRow(mid, 'row_sibling', mid, mygrid1);     
        }
        mygrid2._srowsCol=mygrid2._f_rowsBuffer=mygrid2._srowsBuf=null;
        mygrid2.filterByAll();     
}

function leftMove() {
var mid = mygrid1.getSelectedRowId();
        var mid = mygrid1.getSelectedRowId();
        mygrid2.filterBy(0);
        mygrid1.moveRow(mid, 'row_sibling', mid, mygrid2);
        mygrid2._srowsCol=mygrid2._f_rowsBuffer=mygrid2._srowsBuf=null;
        mygrid2.filterByAll();
}

Thanks for  extra support which, as ever, rocks !

Answer posted by Support on Sep 11, 2009 10:11
The above code has not any visible traits.
The serious slow down of grid in srnd mode can be caused by some logic which will require all row rendering ( iterating through all grid and changing row color for example ) , but simple call to moveRow must not cause such drastically effect. 

Do you have any other custom code, which triggered by row moving ?
Answer posted by hony on Sep 13, 2009 23:30

 yes , i did  with you said,i update mycode with delete all of custom css,it turned to faster than ever.

and when i update the js function leftMove to like this:

  function leftMove(){

var mid = mygrid1.getSelectedRowId();
        var mid = mygrid1.getSelectedRowId();
        mygrid1.moveRow(mid, 'row_sibling', mid, mygrid2); 

}

  it became to the fastesst ,and the filter data with problem which rows were moved  appear. do you have other good idea to prevent the problem to happen?

thX very much ..

 hony