Cheers,
Ivan
var save = false;
$("#tree")
.bind("reselect.jstree", function(event, data) { save = true; })
.bind("change_state.jstree", function(event, data) {
if(save) {
// do stuff
}
});
I guess it should work.
Cheers,
Ivan
var save = false;
$("#tree")
.bind("reselect.jstree", function(event, data) { save = true; })
.bind("change_state.jstree", function(event, data) {
if(save)
{
alert('save');
}
});
It alert all the time when I init the tree.
On 19 Juni, 21:46, vakata <ivan.bozha...@gmail.com> wrote:
> Well, I was thinking of something like this:
>
> var save = false;
> $("#tree")
> .bind("reselect.jstree", function(event, data) { save = true; })
> .bind("change_state.jstree", function(event, data) {
> if(save) {
> // do stuff
> }
> });
>
> I guess it should work.
>
> Cheers,
> Ivan
>
> > > On 6 Юни, 12:26,Thomas<thomas.anders...@gmail.com> wrote:
>
> > > > Thanks!
>
> > > > Is it possible to check if select_node is triggered by the check_node
> > > > method or by mouse click?
>
> > > > I want to save the tree after each change in the three, but now it
> > > > saves for each check_node call when I render the initial tree.
>
> > > > On 5 Juni, 12:40, vakata <ivan.bozha...@gmail.com> wrote:
>
> > > > > Try binding to "change_state" for checkboxes.
>
> > > > > Cheers,
> > > > > Ivan
>
.bind("init.jstree", function () { save = false; })
Otherwise the code should work - it is tested. If you have any more
problems, please paste your config & data here, or even better -
provide a live demo.
Kindest regards,
Ivan
Added another check:
updateTree = true;
Before i run the "check_node" loop: $("#tree").jstree("check_node",
'#'+data.catid);
And then check for it also:
if(save && !updateTree)
{
alert(save);
> > > > > > > select_nodeeventcan, but that won't work for you.
> > > > > > > So you can listen for the "reselect"event, and start saving after
> > > > > > > that has fired.
>
> > > > > > > Cheers,
> > > > > > > Ivan
>
> > > > > > > On 6 Юни, 12:26,Thomas<thomas.anders...@gmail.com> wrote:
>
> > > > > > > > Thanks!
>
> > > > > > > > Is it possible to check if select_node is triggered by the check_node
> > > > > > > > method or by mouse click?
>
> > > > > > > > I want to save the tree after eachchangein the three, but now it
> > > > > > > > saves for each check_node call when I render the initial tree.
>
> > > > > > > > On 5 Juni, 12:40, vakata <ivan.bozha...@gmail.com> wrote:
>
> > > > > > > > > Try binding to "change_state" for checkboxes.
>
> > > > > > > > > Cheers,
> > > > > > > > > Ivan
>
> > > > > > > > > On 5 Юни, 12:48,Thomas<thomas.anders...@gmail.com> wrote:
>
> > > > > > > > > > Hello!
>
> > > > > > > > > > Trying to get the select_nodeeventto fire when checking a checkbox,
As a matter of fact, the 'select_node.jstree' event is triggered
everytime you select a node(s) and also if 'initially_select' option
is set (and the selecting node exists), unless you prevent it from
triggering in the 'before.jstree' event.
Best regards,
ChrisRaven
jstree.bind('select_node.jstree', function(){alert("selected")})
where 'jstree' is the name of my element (and this works with other
binds).
That doesn't do anything? Am I doing it wrong?