Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stanislav on Oct 16, 2009 06:38
open dhtmlx forum
dhtmlXGrid drag and drop operation is very slow with skin setting

Hello.
Here is my grid initialization:

XGridCustomersAv = new dhtmlXGridObject('xgrid_customers_av');
XGridCustomersAv.setImagePath("../jscripts/dhtmlxgrid/imgs/");
XGridCustomersAv.setHeader("Customers");
XGridCustomersAv.setNoHeader(true);
XGridCustomersAv.setInitWidths(xgrid_initwidth);
XGridCustomersAv.setColAlign("left");
XGridCustomersAv.setColTypes("ro");
XGridCustomersAv.setColSorting("str");
XGridCustomersAv.setColumnHidden("false");
XGridCustomersAv.enableDragAndDrop(true);
XGridCustomersAv.init();
XGridCustomersAv.setSkin("modern");

XGridCustomersSl = new dhtmlXGridObject('xgrid_customers_sl');
XGridCustomersSl.setImagePath("../jscripts/dhtmlxgrid/imgs/");
XGridCustomersSl.setHeader("Customers");
XGridCustomersSl.setNoHeader(true);
XGridCustomersSl.setInitWidths(xgrid_initwidth);
XGridCustomersSl.setColAlign("left");
XGridCustomersSl.setColTypes("ro");
XGridCustomersSl.setColSorting("str");
XGridCustomersSl.setColumnHidden("false");
XGridCustomersSl.enableDragAndDrop(true);
XGridCustomersSl.init();
XGridCustomersSl.setSkin("modern");

XGridCustomersAv.attachEvent('onDrag', function(sid, tid, sobj, tobj) { return (sobj == XGridCustomersSl); });
XGridCustomersSl.attachEvent('onDrag', function(sid, tid, sobj, tobj) { return (sobj == XGridCustomersAv); });

The XGridCustomersAv grid is filled with about 500 rows.
Drag and dropping all of them at the same time to the XGridCustomersSl takes about 10 seconds.
After commenting the skin setting for both grid gives only 1 second.
Will you please advise how to increase the speed for skinned grid?
Answer posted by dhxSupport on Oct 16, 2009 08:33
>>Drag and dropping all of them at the same time to the XGridCustomersSl takes about 10 seconds.
Unfortunately there is no way to increase dpopping of 500 rows at the same time. If you really need move 500 rows from one grid to another better to load them with load() method and Smart Rendering mode enabled. 
Answer posted on Oct 19, 2009 07:33
I've tried this solution and it almost works:

XGridCustomersAv.attachEvent('onDrag', function(sid, tid, sobj, tobj) {
  if ( sobj == XGridCustomersSl ) {
    sobj.startFastOperations();
    tobj.startFastOperations();
    return true;
  }
});

XGridCustomersSl.attachEvent('onDrag', function(sid, tid, sobj, tobj) {
  if ( sobj == XGridCustomersAv ) {
    sobj.startFastOperations();
    tobj.startFastOperations();
    return true;
  }
});

var onDropFunc = function (sid, tid, did, sobj, tobj) {
  sobj.stopFastOperations();
  tobj.stopFastOperations();
  sobj.adjustColumnSize(0);
  tobj.adjustColumnSize(0);
}

XGridCustomersAv.attachEvent('onDrop', onDropFunc);
XGridCustomersSl.attachEvent('onDrop', onDropFunc);

Speed is very good in this case and the only problem that enabling this FastOperations mode seems disables onDrop event so at the end the view is not normalizing.
Answer posted by dhxSupport on Oct 19, 2009 07:51
Fast operations disables all events in grid. That's why drag-n-drop with fast operations will not work. 
Answer posted by Stanislav on Oct 19, 2009 12:02
So are there any ways to determine in this mode that current drag and drop operation is completed?
Or maybe you can suggest some other methods for this operation?