I want to add a click event to jstree asynchronous list items.
Ideal result: when I click elements in jstree, the contents of the element will be passed to the sql query as a parameter, and then the query is executed and displays the result set on the same page or on another page.
While I do not know how to implement it. I found the following code in jquery.tree.js. And I think I should change this event. But I do not know how to do this. Can you see the code and give me some tips or tricks?
$("#" + this.container.attr("id") + " li a")
.live("click.jstree", function (event) {
if(event.which && event.which == 3) return true;
if(_this.locked) {
event.preventDefault();
event.target.blur();
return _this.error("LOCKED");
}
_this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on"]);
if(_this.inp) { _this.inp.blur(); }
event.preventDefault();
event.target.blur();
return false;
})
Page Code:
<script type="text/javascript" >
$(function () {
$("#async_json_1").tree({
data : {
type : "json",
opts : {
url : "twodimen.php"
}
},
callback:{
onselect: function(node,tree){
}
}
});
});
</script>
Many thanks.
source
share