jquery-sortable
jquery-sortable copied to clipboard
There Doesn't Seem to be a Way to Update Sortable Options After Init
FYI this is easily the best sortable plugin I've found for adding drag and drop support for tables. Nice job!
Only thing I noticed during my tests is that there is no way to update the sortable options after it has been initialized. For example, a user might want to update the serialize function after initialization.
// initialize the sorting on a table
$('.myTable').sortable({
containerSelector: 'table',
itemPath: '> tbody',
itemSelector: 'tr',
placeholder: '<tr class="placeholder"/>',
serialize: function(parent, children, isContainer) {
return isContainer ? children.join() : $('input[name="ID"]', parent).val();
}
// update serialize
$('.myTable').sortable("option", "serialize", function(parent, children, isContainer) {
console.log('hi there');
});
Did I miss how to do this in the documentation somewhere? Currently the only way I can think of to update it is to destroy sortable and re-init.
Interested to see that too