sort eats dnd move_node.jstree events?

220 views
Skip to first unread message

J.C. Wren

unread,
Apr 27, 2014, 8:29:47 PM4/27/14
to jst...@googlegroups.com
When an item is dragged from one folder to another, I need to see the move_node.jstree event to so I can update some internal data. 

Doing a 'console.dir (data.old_instance)' and 'console.dir (data.new_instance)', in the move_node.jstree event listener, I see $.jstree.plugin.dnd for both, and life is good.

However, when the sort plugin is enabled, I get $.jstree.plugin.sort for both. 

It's not surprising that sort generates the move_node.jstree events, but it creates a problem in that I no longer know what node was dragged from where to where before it sorts.

While it would be acceptable to manually trigger a sort in the move_node.jstree handler, this would (I imagine) trigger a second move_node.jstree event, leading to one level of recursion. Also, I'm honestly not sure I can manually trigger a sort, since I just started using jstree today.

Shouldn't there be an additional event for supported for sorting, like sort_node.jstree? Or perhaps telling sort to post the original mode_node.jstree events before sorting? I should be able to filter the $.jstree.plugin.sort types in the listener.

Thanks,
--jc

Ivan Bozhanov

unread,
Apr 28, 2014, 5:40:10 AM4/28/14
to jst...@googlegroups.com
I am sorry, but I have no idea what you mean? Sort does not trigger an event, neither a move_node operation - it simply reacts on the move_node.jstree event and does its sorting.
The parameters are not changed in any way ... You get the same data regardless of using sort or not. I have no idea where you get: $.jstree.plugin.dnd ... Please show me your code, as I do not understand. You are using 3.0 right?

Best regards,
Iva
Reply all
Reply to author
Forward
0 new messages