Nov 09, 2012, 3:52 PM
[CLOSED] Check child nodes treepanel
Last edited by Baidaly; Nov 10, 2012 at 3:47 AM.
var onCheckChange = function (node, checked) {
if (!this.locked) {
this.locked = true;
if (node.hasChildNodes()) {
node.cascade(function (childNode) {
childNode.set("checked", checked);
});
}
var nodoPadre = node.parentNode;
if (nodoPadre != null) {
if (checked == false) {
nodoPadre.set("checked", false);
var nodoPadre2 = nodoPadre.parentNode;
if (nodoPadre2 != null) {
nodoPadre2.set("checked", false);
}
} else{
var todosCheck = true;
nodoPadre.cascade(function (childNode2) {
if ((childNode2.data.checked == false) && (nodoPadre.data.text != childNode2.data.text)) {todosCheck = false; }
});
if (todosCheck == true) { nodoPadre.set("checked", true); }
var nodoPadre2 = nodoPadre.parentNode;
if (nodoPadre2 != null) {
var todosCheck2 = true;
nodoPadre2.cascade(function (childNode3) {
if ((childNode3.data.checked == false) && (nodoPadre2.data.text != childNode3.data.text)) {todosCheck2 = false; }
});
if (todosCheck2 == true) { nodoPadre2.set("checked", true); }
}
}
}
this.locked = false;
}
};