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

Node Position Sequence #2765

Open
taryono opened this issue Jan 19, 2024 · 0 comments
Open

Node Position Sequence #2765

taryono opened this issue Jan 19, 2024 · 0 comments

Comments

@taryono
Copy link

taryono commented Jan 19, 2024

I Have One Menu and Five childrens like this

{ id:1, text: "Sub Nodes", icon: "fa fa-folder text-danger", children: [ { id:2,text: "Item 1", icon: "fa fa-folder text-waring" }, { id:3,text: "Item 2", icon: "fa fa-folder text-success" }, { id:4,text: "Item 3", icon: "fa fa-folder text-default" }, { id:5,text: "Item 4", icon: "fa fa-folder text-danger" }, { id:6,text: "Item 5", icon: "fa fa-folder text-info" }, ], },
When I move the children Item 1 to the last position I get the posistion is 5, but when I move it as First children I get the position is 0

I try to add console.log(pos) in jstree.js line 4188

console.log('pos',pos)

switch(pos) {
case "before":
pos = $.inArray(par.id, new_par.children);
break;
case "after" :
pos = $.inArray(par.id, new_par.children) + 1;
break;
case "inside":
case "first":
pos = 0;
break;
case "last":
pos = new_par.children.length;
break;
default:
if(!pos) { pos = 0; }
break;
}

then I inspect element -> console I see
pos 0 , pos 1, pos 2 etc...

sorry I just try it and I revert it back

Thanks

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