johnny / johnny/jquery-sortable

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

Open
#214 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
1.5k
Forks
429
PR merge metrics
No merged PRs in 30d

Description

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: '',
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.