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

Add option to append nodes at top. [PR request pending] #208

Open
Nejaa opened this issue Nov 16, 2017 · 0 comments
Open

Add option to append nodes at top. [PR request pending] #208

Nejaa opened this issue Nov 16, 2017 · 0 comments

Comments

@Nejaa
Copy link

Nejaa commented Nov 16, 2017

EDIT : See PR request

I had this need lately. I made it work by adding a non core parameter to the options :

_table.treetable({
    expandable: true,
    clickableNodeNames: true,
    onNodeExpand: onNodeExpand,
    prependRootNodes: true //Not a core parameter.
});

Then I modified the loadBranch function like that :

loadBranch: function (node, rows) {
            //...          
            if (node == null) { // Inserting new root nodes
                if (settings.prependRootNodes)
                    this.prepend(rows);
                else
                    this.append(rows);
            } else {
                var lastNode = this.data("treetable").findLastNode(node);
                rows.insertAfter(lastNode.row);
            }
            //...
        }

Of course this isn't the only way to go at it. My first idea was to add a parameter to loadBranch that would tell the function to append at the top only for this load request.

In any cases both options wouyld be nice to have in the core plugin. I hope this is helpfull :)

@Nejaa Nejaa changed the title Add option to append nodes at top. Add option to append nodes at top. [PR request pending] Nov 16, 2017
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

1 participant