nestedSortable
nestedSortable copied to clipboard
Allows starting individual branches expanded or collapsed
This update allows you to explicitly define the starting state of individual branches to be either expanded or collapsed beyond the default starting state of all collapsed or all expended. This allows overriding the default startCollapsed option on a per-branch level as needed.
On any branches you wish to start as explicitly collapsed or expanded, simply apply your defined (or default if you did not define) expandedClass or collapsedClass classname to the applicable
I needed this so that I could ‘remember’ the state of individual branches and restore them on page load.
Could you include a usage example ? In the absence of tests, that's the closest thing..
Here's a usage example. If you wish to override the default behavior (which is either all open or all closed based on the startCollapsed setting), just apply the appropriate class to the li to force it to start whichever way you like.
<ol class="sortable">
<li class="mjs-nestedSortable-expanded"><div>Starts open, overriding default</div></li>
<li class="mjs-nestedSortable-collapsed"><div>Starts collapsed, overriding default</div></li>
<li><div>Starts open or closed based on startCollapsed setting; default behavior </div></li>
</ol>