nestedSortable icon indicating copy to clipboard operation
nestedSortable copied to clipboard

Allows starting individual branches expanded or collapsed

Open dustinbolton opened this issue 11 years ago • 2 comments

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

  • branch (or whatever you are using as your defined entity in the "items" setting).

    I needed this so that I could ‘remember’ the state of individual branches and restore them on page load.

  • dustinbolton avatar Jan 22 '14 01:01 dustinbolton

    Could you include a usage example ? In the absence of tests, that's the closest thing..

    deanrad avatar Feb 10 '14 03:02 deanrad

    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>
    

    dustinbolton avatar Feb 10 '14 05:02 dustinbolton