I have a datatree with many nodes and child nodes. I use check boxes in a template. I have it set so that when you click on a node it expands and collapses. However when there is a child node that is checked I want to cancel the collapse method...
Can you help with this?
Hi Daryl007,
You can use something similar to this function for NodeCollapsing client-side event:
function WebDataTree1_NodeCollapsing(sender, eventArgs)
{
var node = eventArgs.getNode();
var childrenCount = node.get_childrenCount();
for (var i = 0; i < childrenCount; i++) {
if (node.get_childNode(i).get_checkState() == 1) {
eventArgs.set_cancel(true);
}
Let me know if this helps.
Okay i have some more info..
I am using this:
<script type="text/javascript" language="javascript"> function wdtGeneral_NodeCollapsing(sender, e) { //Gets the node object that is collapsing var node = e.getNode(); var childrenCount = node.get_childrenCount(); alert('nodes ' + childrenCount) for (var i = 0; i < childrenCount; i++) { alert(i) alert(node.get_childNode(i).get_checkState()) if (node.get_childNode(i).get_checkState() == 1) { e.set_cancel(true); } } } </script>the first alert gives me the childnode count.second alert always give me a 0 as does the third alert..could this because I am using a checkbox template in each node?
<Nodes> <ig:DataTreeNode Draggable="False" Droppable="False" Editable="Off" TemplateId="chkOne" Key="chkOne" Value="chkOne" CssClass="options" > <Template> <asp:CheckBox ID="chkOne" Text="This is check one" runat="server" CssClass="options" TabIndex="1" /> </Template> </ig:DataTreeNode>
tried that function...
changed the name of function...
and added a client event on node collapsing..
what am i doing wrong>?