I have created a table with sortable rows using the jQuery ui sortable widget and everything was fine until I had the need to change some things on my table.
- Disable a table column unchecking an input checkbox
- Disable a table row unchecking another input checkbox
When I uncheck those inputs, and start dragging and dropping the table rows, suddenly the row gets "stuck" (just like if the mouse button were not released) and verifying the events from sortable I figured out that the beforeStop event is never reached. The events I have checked out are: start, activate, change, beforeStop, update, deactivate and out. It's a little tricky to get to this, sometimes occur when you start to drag and drop quickly or when you first deactivate a column, then a row and then dragging and dropping.
I also have some functions to order indexes and one function puts the disabled row to the end of the table (Stack Overflow force me to put some code, but all of it it's on the fiddle):
function createSortable() {
$("#config_body").sortable({
items: 'tr:not(:first)',
update: function (event, ui) {
},
stop: function(event, ui){
setTimeout(
function(){
reorder_rows();
},
200
);
}
});
}
Here is the fiddle: https://jsfiddle.net/hedka77/8uwmm2vp/4/