Checkbox events with jsTree

2,532 views
Skip to first unread message

Paul Mantz

unread,
Nov 7, 2013, 1:43:29 PM11/7/13
to jst...@googlegroups.com
Hello,

I am using jsTree to display a compatibility list from one objects to many. The list can be dynamically changed, so odds are is it will get pretty big. As a result, I would like to deal with events on a per-item basis, rather than deal with the total state of the list. This is especially true since the list may not have all the elements that are represented.

I explored the "check_node.jstree" event, but the "event.target" was the list itself, instead of the node that was checked. I also checked "event.currentTarget", but again the list. Is there a way to find the specific list item that was clicked so that I can perform an action on that element only?

Abu

unread,
Nov 12, 2013, 6:01:11 PM11/12/13
to jst...@googlegroups.com
"check_node" is an event from the "checkbox" plugin.

you can try "select_node" from the "ui" plugin or
$('.jstree-clicked') to find the selected node

HTH

jst...@googlegroups.com

unread,
Nov 18, 2013, 8:55:16 AM11/18/13
to jst...@googlegroups.com

Hi,

 

Checked node should have the  CSS class ‘jstree-checked’

(in V1)

 

$("li").each(function(){

                if($(this).attr("class").match('jstree-checked'){

                                alert(“checked”);

}

}

 

// bind event for a selected node

$("#divtree").bind("select_node.jstree", function(e,data){

                listkeys(data.rslt);

                listkeys(data.inst);

                // the node id

                alert("ID :"+data.rslt.obj.attr("id"));

                // The node name

                alert("TEXT :"+data.inst.get_text());

}

 

//debug function

listkeys = function(obj) {

        var str = '';

        for(j in obj) {str += typeof(obj[j]) + ' : ' + j + '\n';}

        alert(str);

                }

 

Patrice

 

De : jst...@googlegroups.com [mailto:jst...@googlegroups.com] De la part de Abu
Envoyé : mercredi 13 novembre 2013 00:01
À : jst...@googlegroups.com
Objet : [jsTree:8127] Re: Checkbox events with jsTree

--
You received this message because you are subscribed to the Google Groups "jsTree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jstree+un...@googlegroups.com.
To post to this group, send email to
jst...@googlegroups.com.
Visit this group at http://groups.google.com/group/jstree.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages