grid icon indicating copy to clipboard operation
grid copied to clipboard

Enabling and disabling drag and drop

Open capitanjacksparrow opened this issue 7 years ago • 1 comments

Is it possible to enable and disable drag and drop on the basis of mouse or touch events? I tried by setting dragAndDrop property in this way, on a click event:

$('#grid').gridList({dragAndDrop: false});

However, the layout changes (it doesn't fit the vertical direction anymore) and the widgets behavior becomes unstable.

capitanjacksparrow avatar Mar 14 '17 09:03 capitanjacksparrow

Try this:

function disableDrag() {
  $('.grid-item').draggable('disable');
  $('.grid-item').bind('dragstart', gridItemDisableHandler);
}

function enableDrag() {
  $('.grid-item').draggable('enable');
  $('.grid-item').unbind('dragstart', gridItemDisableHandler);
}

Note that you have to add grid-item class to the items.

bojan88 avatar Jul 25 '17 08:07 bojan88