Using Firebug to view its generated HTML, find that its checkobx is fake, just a span, back and forth of the variable style only, Khan
Copy Code code as follows:
$ (". Tree-checkbox", tree). Unbind (". Tree"). Bind ("Click.tree", function () {
if ($ (this). Hasclass ("tree-checkbox0")) {
$ (this). Removeclass ("tree-checkbox0"). AddClass ("Tree-checkbox1");
} else {
if ($ (this). Hasclass ("Tree-checkbox1")) {
$ (this). Removeclass ("Tree-checkbox1"). AddClass ("tree-checkbox0");
} else {
if ($ (this). Hasclass ("Tree-checkbox2")) {
$ (this). Removeclass ("Tree-checkbox2"). AddClass ("Tree-checkbox1");
}
}
}
_2eb ($ (this). parent ());
_2EC ($ (this). parent ());
return false;
});
And then look at its onclick event script
Code
Copy Code code as follows:
$ (". Tree-node", tree)
....
Bind ("Click.tree", function () {
$ (". tree-node-selected", tree). Removeclass ("tree-node-selected");
$ (this). addclass ("tree-node-selected");
if (Opts.onclick) {
var _2ea = this;
var data = $.data (this, "Tree-node");
Opts.onClick.call (this, {id:data.id, text:data.text, attributes:data.attributes, Target: _2ea});
}
})
Modify its check script accordingly
Copy Code code as follows:
$ (". Tree-checkbox", tree). Unbind (". Tree"). Bind ("Click.tree", function () {
if ($ (this). Hasclass ("tree-checkbox0")) {
$ (this). Removeclass ("tree-checkbox0"). AddClass ("Tree-checkbox1");
} else {
if ($ (this). Hasclass ("Tree-checkbox1")) {
$ (this). Removeclass ("Tree-checkbox1"). AddClass ("tree-checkbox0");
} else {
if ($ (this). Hasclass ("Tree-checkbox2")) {
$ (this). Removeclass ("Tree-checkbox2"). AddClass ("Tree-checkbox1");
}
}
}
_2eb ($ (this). parent ());
_2EC ($ (this). parent ());
return false;
}. Bind ("Click.tree", function () {//gzl added
if ($ (this). Hasclass ("Tree-checkbox1") && Opts.oncheck) {
var _2e9 = this;
var data = $.data (this, "Tree-node");
Opts.onCheck.call (this, {id:data.id, text:data.text, attributes:data.attributes, Target: _2e9});
}
});
But how can not get the data value, and finally have to $ (this). Parent (). Click (), click event Plus check becomes checked, two events in one way, alas.
I would like to have a new version, or a Daniel to change, my ability is too limited.