Hi,
Can anyone let me know how to get all the nodes in javascript when button click.
i need the function to get all the node in button click but get_checkedNodes will be in checked change event of tree view . how can i get the get the checked nodes in treeview without any treeview events.
i have been using the following code but it error is comming,
var nodes = new Array;
var tree = document.getElementById('ctl00_ContentPlaceHolder1_WebTab1_tmpl0_WebDataTree1');
nodes = tree.get_checkedNodes();
var CompGuid = "";
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].get_checkState == 1) {
//if (CompGuid.length > 0) {
CompGuid += ",";
//}
CompGuid += nodes[i].value;
}
Thanks in Advance.
Hi anilkoomar_1202,
Thank you for your reply. Glad that the matter has been resolved.
Please feel free to contact me if you have any further questions regarding this matter.
Hi Petar Ivanov,
Thanks it helps me.code is working.
Thank You
Note that get_checkState is a function and not a property, i.e the above code should look like:
for (var i = 0; i < nodes.length; i++) { if (nodes[i].get_checkState() == 1) { CompGuid += nodes[i].value+","; } }
if (nodes[i].get_checkState() == 1) {
CompGuid += nodes[i].value+",";
Hope this helps.
i was unable to get it.i was using the following code for retriving the node value. i was using v11.1
Thanks in Advance
Can you confirm that the node itself is accessible, i.e. nodes[i] , as the get_checkState() function is returning 1 when I am testing my sample (as expected) ?