I am trying to create a jstree . As per my requirement, i have to display the
parent nodes first and when clicking on the parent node, all the child nodes
should be displayed. All the data is in my mysql database. Am using grails to
generate the json.
Following is my gsp. I am able to display the parent nodes but when am
selecting/clicking on the parent node, child nodes are not being populated.
Please help:
<head>
<script type="text/javascript"
src="http://static.jstree.com/v.1.0rc2/jquery.js"></script>
<script type="text/javascript"
src="http://static.jstree.com/v.1.0rc2/jquery.jstree.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#demo1").jstree({
"json_data" : {
"ajax" :{
"url":"ajaxtest",
"data":function(n){
return { id: n.attr ? n.attr("id") :0 }
}
}
},
"plugins" : [ "themes", "json_data", "dnd" ]
});
$('#demo1').bind("select_node.jstree", function (e, data) {
data.rslt.o.each(function (i) {
$.ajax({
url: "createchild",
data: {
"id": $(this).attr("id")
},
success: function (r) {
Refresh();
}
});
});
});
});
</script>
</head>
<body>
<div class="body">
<div name="demo1" id="demo1">
</div>
</body>
Original issue reported on code.google.com by kavithas...@gmail.com on 14 Feb 2012 at 6:37
Original issue reported on code.google.com by
kavithas...@gmail.com
on 14 Feb 2012 at 6:37