Skip to content

Conversation

@dustinbolton
Copy link

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.

  • This update allows you to preset the expanded or collapsed class on
    individual branches to give finer grain control over individual branch
    status on start. This allows overriding the default startCollapsed
    option on a per-branch level as needed.
    
    I needed this so that I could ‘remember’ the state of individual
    branches and restore them on page load.
    @deanrad
    Copy link

    deanrad commented Feb 10, 2014

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

    @dustinbolton
    Copy link
    Author

    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>

    Copy link
    Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Usage example:

    <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>

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants