Skip to content

Open/Close of nodes slows down as tree grows due to unactivateAll behavior #4

@jsbohnert

Description

@jsbohnert

Experienced this issue with a tree of middling size (~3000 nodes, built at init from json data).

At this size, there is a palpable (~1sec) delay for me in expanding and closing nodes with children. This is almost exclusively because of the sweep the plugin does to remove the active class from the nodes, which it does by calling $("#" + node.id) for every node in the tree.

After some experimentation, I settled on a small patch to the behavior which greatly improved usability - for the first level (first non-recursive call to unactiveAll), a single jquery search for the active class below the node's parent ul element can pull of the class in one call. Successive recursions of unactivateAll don't manipulate the dom.

I'd be happy to branch my fork and submit this change as a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions