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://ko.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'
Did i say I am using templated check boxes?
Sorry for the confusion, I will provide you with the code for WebDataTree shortly.
Hello Daryl,
I am attaching a small sample, demonstrating the functionality you described.
<ig:WebDataTree ID="wdtGeneral" runat="server" EnableConnectorLines="True" EnableExpandImages="False" Height="360px" SelectionType="Multiple" StyleSetName="Default" Width="90%" EnableTheming="False" CssClass="options"> <DragDropSettings EnableDropInsertion="False" EnableExpandOnDrop="False"> </DragDropSettings> <Nodes> <ig:DataTreeNode Draggable="False" Droppable="False" Editable="Off" TemplateId="chkCoEvaluate" Key="chkCoEvaluate" Value="chkCoEvaluate" CssClass="options" Expanded="True" > <Template> <asp:CheckBox ID="chkCoEvaluate" Text="The CO is evaluating" runat="server" CssClass="options" TabIndex="1" /> </Template> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkTeams" Key="chkTeams" Value="chkTeams" Expanded="True" > <Template> <asp:CheckBox ID="chkTeams" Text="Teams are used in this evaluation" runat="server" CssClass="options" TabIndex="2" /> </Template> <Nodes> <ig:DataTreeNode TemplateId="chkTeamLeaders" Key="chkTeamLeaders" Value="chkTeamLeaders" Expanded="True" > <Template> <asp:CheckBox ID="chkTeamLeaders" Text="Team leaders are evaluating" runat="server" CssClass="options" TabIndex="3" /> </Template> </ig:DataTreeNode> </Nodes> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkMessage" Key="chkMessage" Value="chkMessage" Expanded="True"> <Template> <asp:CheckBox ID="chkMessage" Text="Messaging is enabled" runat="server" CssClass="options" TabIndex="4" /> </Template> <Nodes> <ig:DataTreeNode TemplateId="chkTimerInterval" Key="chkTimerInterval" Value="chkTimerInterval" Expanded="True" > <Template> <table> <tr> <td valign="middle"> <asp:CheckBox ID="chkTimerInterval" Text="interval to check for new messages" runat="server" CssClass="options" TabIndex="5" /> <asp:RadioButtonList ID="optTimerInterval" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="options" TabIndex="6" EnableTheming="False"> <asp:ListItem Text="3" Value="3">3 Min </asp:ListItem> <asp:ListItem Value="5">5 Min </asp:ListItem> <asp:ListItem Value="10">10 Min </asp:ListItem> <asp:ListItem Value="15">15 Min </asp:ListItem> </asp:RadioButtonList> </td> </tr> </table> </Template> </ig:DataTreeNode> </Nodes> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkAdvisor" Key="chkAdvisor" Value="chkAdvisor" Expanded="True"> <Template> <asp:CheckBox ID="chkAdvisor" Text="Advisors are used in this evaluation" runat="server" CssClass="options" /> </Template> <Nodes> <ig:DataTreeNode TemplateId="chkAdvView" Key="chkAdvView" Value="chkAdvView" Expanded="True" > <Template> <asp:CheckBox ID="chkAdvView" Text="Advisors view other Advisors comments" runat="server" CssClass="options" /> </Template> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkAdvViewEval" Key="chkAdvViewEval" Value="chkAdvViewEval" Expanded="True"> <Template> <asp:CheckBox ID="chkAdvViewEval" Text="Add view Evaluator comments" runat="server" CssClass="options" /> </Template> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkAdvEval" Key="chkAdvEval" Value="chkAdvEval" Expanded="True" > <Template> <asp:CheckBox ID="chkAdvEval" Text="Advisor comments move to consensus" runat="server" CssClass="options" /> </Template> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkAdvRate" Key="chkAdvRate" Value="chkAdvRate" Expanded="True" > <Template> <asp:CheckBox ID="chkAdvRate" Text="Advisors assign a rating" runat="server" CssClass="options" /> </Template> <Nodes> <ig:DataTreeNode TemplateId="chkAdvRateShow" Key="chkAdvRateShow" Value="chkAdvRateShow" Expanded="True" > <Template> <asp:CheckBox ID="chkAdvRateShow" Text="Show Advisor ratings" runat="server" CssClass="options" /> </Template> </ig:DataTreeNode> </Nodes> </ig:DataTreeNode> </Nodes> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkCommentRef" Key="chkCommentRef" Value="chkCommentRef" Expanded="True" > <Template> <asp:CheckBox ID="chkCommentRef" Text="Evaluator comments must reference proposal" runat="server" CssClass="options" /> </Template> </ig:DataTreeNode> <ig:DataTreeNode TemplateId="chkRndCons" Key="chkRndCons" Value="chkRndCons" Expanded="True" > <Template> <asp:CheckBox ID="chkRndCons" Text="Show previous rounds comments in Consensus Module" runat="server" CssClass="options" /> </Template> </ig:DataTreeNode> </Nodes> </ig:WebDataTree>
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.
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.
Could you try what I sent you but wrap it in a webtab? Could that have an effect.