Hi all,
is it possible to disable onlick="" while sorting?
i created a working example here -> http://www.jsfiddle.net/V9Euk/59/
greetz from germany Peter
Hi all,
is it possible to disable onlick="" while sorting?
i created a working example here -> http://www.jsfiddle.net/V9Euk/59/
greetz from germany Peter
you can use start
and stop
options:
$( ".selector" ).sortable({
start: function(event, ui) { ... },
stop: function(event, ui) { ... }
});
Just create a flag and set to true when sorting started and to false when the sorting is over and in your onclick function check the flag first:
var isBeingSorted = false
$( ".selector" ).sortable({
start: function(event, ui) { isBeingSorted = true; },
stop: function(event, ui) { isBeingSorted = false; }
});
function printAlert(message){
if(!isBeingSorted)
alert(message);
}
And of course your onclicks should look like onclick="printAlert('sdfsdf')"
For more options look here
If you don't want to do it with a flag variable as per @nigative , you can do the following with the start and stop methods:
$("#lop").sortable({
revert: '100',
placeholder: 'auo',
start: function(event, ui) {
ui.item[0].oldclick = ui.item[0].onclick;
ui.item[0].onclick = null;
},
stop: function(event, ui) {
ui.item[0].onclick = ui.item[0].oldclick;
}
});