Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting jsTree #113

Open
ghost opened this issue Sep 4, 2017 · 0 comments
Open

Sorting jsTree #113

ghost opened this issue Sep 4, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 4, 2017

I'm trying to use nastedSortable/UI-Sortable with JSTree and it works quite well.
The only thing that doesn't work as expected is the expanding of subnodes which is normal because it's jstree specific.

So i implemented it with an onhover event that a sublist expands while the user is hovering a collapsed node in the tree.

The problem is such a behaviour makes ui-sortable unstable. I tried to use "refresh" and "refreshPosition" but it didn't help.

see the attached video without the hover expander, it works quite well:
https://youtu.be/exIUJUYhIKY

after enabling[1] the hover expander code(which modifies the sublist) ui-sortable goes crazy even with "refresh":
https://www.youtube.com/watch?v=AKjVNpgSsOI

expander code[1]:

$(this.EXPANDABLE_NODE_SELECTOR).hover(_.debounce(this.addExpandHover.bind(this), this.DEBOUNCE_TIMEOUT));


    private addExpandHover(event: any) {
        if (this.sortingInProgress) {
            let nodeId = event.target.id;
            this.jsTreeHandler.open_node(nodeId, () => {
                $(this.EXPANDABLE_NODE_SELECTOR).off('hover');
                $(this.EXPANDABLE_NODE_SELECTOR).hover(_.debounce(this.addExpandHover.bind(this), this.DEBOUNCE_TIMEOUT));
                this.sortable.sortable('refreshPositions'); // doesnt work
            }, 100);
        }
    }
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

No branches or pull requests

0 participants