I am attempting to set up an instance where, if a parent node is checked then the children are checked and if the parent is unchecked the children should be unchecked.
I assume this is done on the client side.
Can I get some assistance with a script?
Hi Daryl,
You can refer to this thread regarding the matter - http://es.infragistics.com/community/forums/p/53859/313719.aspx.
Let me know if you have any questions.
On this line
function ClickHandler(sender, args) { isChecked = args.get_item().get_row().get_cell(0).get_element().children[0].checked;I get an error message stating that "Microsoft JScript runtime error: Object doesn't support property or method 'get_item'
Hi,
I tested the sample with your markup and it works correctly. Just replace '#WebDataTree1' with '#wdtGeneral' in the script.
I am sorry, but it just doesn't work for me.
I have implemented the script as instructed. But the check box click event is not firing.
If doesn't change the child node check boxes.
I will play with it some more, but it just isn't working with my templated controls.
Hello Daryl,
Provide me with an isolated sample project and I will be happy to assist you finding what is causing the issue.
Could you try what I sent you but wrap it in a webtab? Could that have an effect.
Okay, I have given up on this and gone to using the built in check boxes.
Now I need to use autocheck, which works, but, when I click a child I don't want the parent changed. I only want it to work when I click the parent then update all the children.
I'm glad I could help.
Feel free to contact me if you have any further questions.
You sir, Are my hero.
Thanks!
You could achieve such behavior using the following script for NodeChecking client side event:
var checkState = 0;
function WebDataTree1_NodeChecking(sender, eventArgs) {
var node = eventArgs.getNode();
checkState = (node.get_checkState() == 0) ? 1 : 0;
setChildrenCheckState(node);
}
function setChildrenCheckState(parentNode) {
if (parentNode.hasChildren()) {
for (var i = 0; i < parentNode.get_childrenCount(); i++) {
parentNode.get_childNode(i).set_checkState(checkState);
if (parentNode.get_childNode(i).hasChildren()) {
setChildrenCheckState(parentNode.get_childNode(i));
In order for this to work, you should set EnableAutoChecking to false.
Let me know if you have any questions regarding the matter.