开发者

jQuery JSTree - check_move and prepare_move fired mutiple times

开发者 https://www.devze.com 2023-04-05 18:12 出处:网络
I need to check if the current node can be moved. I\'m able to do this, but \"check_move\" callback or binded \"prepare_move\" function is called multiple times. It\'s annoying when the same message i

I need to check if the current node can be moved. I'm able to do this, but "check_move" callback or binded "prepare_move" function is called multiple times. It's annoying when the same message in alert box is diplayed few times.

How I can display the alert box one time or how i can modify JSTree in order to callback wont be displayed o开发者_开发知识库ne after another?


I think it's called every time you drag the node you are moving over a new node, to check if it's a valid move. So if you grab a node and move it over 4 nodes, check_move will get called at least 4 times.

If you are debugging try console.log() instead of alert(), it will work better for you (look for the messages in the JavaScript console).

If you want to display an alert or something after the move is complete, bind to the move_node event instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号