grid
grid copied to clipboard
Enabling and disabling drag and drop
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.
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.