jquery-sortable icon indicating copy to clipboard operation
jquery-sortable copied to clipboard

There Doesn't Seem to be a Way to Update Sortable Options After Init

Open homestar9 opened this issue 9 years ago • 1 comments

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.

homestar9 avatar May 04 '16 16:05 homestar9

Interested to see that too

GerkinDev avatar Jan 23 '17 17:01 GerkinDev