jquery - JsTree .get_checked function doesn't work... help....? -


i'm using jstree , checkbox plugin, couldn't managed pick nodes selected (checked), read in jstree documentation event .get_checked, not know how implement it, neither place put it, if within function data loaded or not, don't understand when event works, ie not know if event executed each time node checked or have array filled every time node chcked... please me ... truth i'm lost , not know how that.

here's jscript code, load of data fine, get_checked function doesn't work...

$(function () {     $("#demo2")         .jstree({              plugins: ["themes", "json_data", "checkbox", "crrm"],                    "json_data": {                     "ajax": {                         "type": "post",                         "url": "/ubicacion/arbol/",                         "data": function (n) { return { id: n.attr ? n.attr("id") : 0} }                 }             }              })          .bind("check_node.jstree", function (event, data) {             alert($.jstree._focused().get_checked().attr('id'));         })      }); 

searching around internet found "middle" solution:

 $(function () {         $("#demo2")         .jstree({              plugins: ["themes", "json_data", "checkbox", "crrm"],             "json_data": {                 "ajax": {                     "type": "post",                     "url": "/ubicacion/gettreeview/",                     "data": function (n) { return { id: n.attr ? n.attr("id") : 0} }                 }             }         }).bind('check_node.jstree', function (e, data) {             alert("nodo elegido " + data.rslt.obj.attr("id"));         });     }); 

i add these lines:

.bind('check_node.jstree', function (e, data) {                 alert("nodo elegido " + data.rslt.obj.attr("id"));             }); 

and had parent node, children doesn't coleected... idea..??

please... me...!!

this how call/get checked nodes

checked = $("#tree").jstree("get_checked",null,true) ;

works nicely me. seems me 'trouble' when , how call .get_checked

could tell want achieve? best if can provide sample on jsfiddle.net

update

working sample on jsfiddle

1) how bind action checking checkbox

$("#jstree").bind('check_node.jstree', function(e, data) {     $("#list").append('<br>clicked , ' + node_is_check(data)); }); 

2) how check if checkbox checked, object = data above

object.inst.is_checked(object.rslt.obj 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -