Apr 14, 2013, 8:57 AM
Check/Select TreePanel nodes programatically through JavaScript
Dears,
I want to select/check a node from a TreePanel based on its ID value (Bound from database), and I use the following code:
But the problem occurs when I tried to read selected nodes from the server side (DirectMethod).
It does not consider the selected/checked node by the above code as selected/checked.
This is my server side (DirectMethod) code:
Please, help.
Note:
- If I selected the nodes using Mouse pointer, the server side code is working perfect.
Regards,
Alaswad
I want to select/check a node from a TreePanel based on its ID value (Bound from database), and I use the following code:
function LoadSelectedNode(MyID) {
for (var i = 0; i<App.MyTreeID.getRootNode().childNodes.length; i++) {
for (var j = 0; j<App.MyTreeID.getRootNode().childNodes[i].childNodes.length; j++) {
if (App.MyTreeID.getRootNode().childNodes[i].childNodes[j].data.id == MyID) {
// I used this way
App.MyTreeID.getRootNode().childNodes[i].childNodes[j].cascade(function (childNode) {
childNode.set("checked", true);
childNode.set("selected", true);
});
// Also used this way
App.MyTreeID.getRootNode().childNodes[i].childNodes[j].set("checked", true );
App.MyTreeID.getRootNode().childNodes[i].childNodes[j].set("selected", true);
break;
}
}
}
}
This code is working just fine, and I saw that the specified node by (MyID) is getting checked/Selected. But the problem occurs when I tried to read selected nodes from the server side (DirectMethod).
It does not consider the selected/checked node by the above code as selected/checked.
This is my server side (DirectMethod) code:
<DirectMethod()> _
Sub LoadSelectedNode()
If Not MyTreeID.CheckedNodes Is Nothing Then
For Each Node As Ext.Net.SubmittedNode In MyTreeID.CheckedNodes
' Do What Ever With Node
Ext.Net.X.Msg.Alert("Alert", Node.NodeID)
Next
Else
Ext.Net.X.Msg.Alert("Alert", "Please, select at least one node from the tree").Show()
End If
End Sub
What's wrong Im doing?Please, help.
Note:
- If I selected the nodes using Mouse pointer, the server side code is working perfect.
Regards,
Alaswad
Last edited by alawibh; Apr 14, 2013 at 9:22 AM.