Drag and drop in the same row

Hello,

in a grid i have 5 columns with calling numbers and would like to drag and drop this numbers in the same row.
Is there an example for that?

Regards, Carsten

There is no ready example, but it is pretty simple, something like

mygrid._drag_validate = false; //allow dnd on the same row mygrid.attachEvent("onDrag", function(sid, tid, sobj, tobj, sind, tind){ mygrid.cells(sid, tind).setValue( mygrid.cells(sid, sind).getValue() ); return false; });

Thanks for your answer but the onDrag event isn’t fired while moving an entry from one cell to another in the same row. The event is only fired if i move to another row.
dhtmlxgrid_drag.js is included.

var mygrid = new dhtmlXGridObject('gridbox');
mygrid.setHeader(...);
mygrid.setColumnIds(...);
mygrid.setInitWidths(...);
mygrid.setColAlign(...);
mygrid.setColTypes(...);
mygrid.setColSorting(...);
mygrid._drag_validate = false;
mygrid.attachEvent("onDrag", function(sid, tid, sobj, tobj, sind, tind) {
  if (sid === tid)
    alert('Yes');
  else
    alert('No');
  return false;
});
mygrid.init();
mygrid.enableDragAndDrop(true);

Solved by changing order.

(...)
mygrid.attachEvent("onDrag",...);
mygrid.init();
mygrid.enableDragAndDrop(true);
mygrid._drag_validate = false;

Hi,

Just checking, so this is possible?

You can drag-drop cells in the same row? I am currently using ExtJS for my grids and there it’s possible, but I have a very large horizontal grid with many columns that does not perform at all so I am looking into using the DHTMLx grid for this, but my requirement is cell drag-n-drop.

  1. So, I want to allow a user to drag a cell (including the content/object behind it) and drop it on a cell in another column and leave the cell in the old column empty, or just swap it.
  2. And I want to prevent the user from moving it into another row.

Is this possible?

I am able to pay for the PRO version if needed.

Thanks
Marco

The solution provided by Stanislav works well.