vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

Prevent checkbox callback #2433

Closed sdraper69 closed 4 years ago

sdraper69 commented 4 years ago

Hi there,

I am using the checkbox plugin, and have a check and uncheck callback defined.

This works great, and exactly as I want when the user checks/unchecks the boxes.

However, sometimes I want to programmatically check/uncheck some nodes, as as such the callbacks are not required.

Is there a way I can check/uncheck an array of nodes without the callback being fired or pass some data to the check function that will be passed to the callback so I can handle it myself? or distinguish between a user clicking the checkbox and me calling check_node/uncheck_node?

vakata commented 4 years ago

Hello, no there is no way to not fire the event (as other plugins may depend on it) - you have to ignore the programmatic event and only process user generated events. There is an easy way to find out which is which - in your event handler check data.event

sdraper69 commented 4 years ago

That's great thanks for the response, exactly what I needed