Jan 17, 2015, 4:31 PM
OK, but you will need to repeat the same process when applying the permissions of a module or submodule elsewhere in your project, eventually.
var onCheckChange = function (obj, node) {
console.log(node)
if (!node.locked) {
node.locked = true;
// if parent is checked/unchecked then check/uncheck all children, too
node.cascadeBy(function (childNode) {
childNode.set(obj.dataIndex, node.data[obj.dataIndex]);
});
// if all children are checked/unchecked then check/uncheck the parent, too
var status = node.data[obj.dataIndex];
node.bubble(function (n) {
var childNodes = this.childNodes;
var length = childNodes.length;
var allCheckStatus = true;
for (var i = 0; i < length; i++) {
if (childNodes[i].data[obj.dataIndex] != status) {
allCheckStatus = false;
break;
}
}
if (allCheckStatus) {
n.set(obj.dataIndex, node.data[obj.dataIndex]);
}
});
}
node.locked = false;
}
l.Load.Handler = "onCheckChange(this,node)";
the function called but check/uncheck a parent functionality not performing.