Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
WebDataTree With Checkbox. How to read all selected checkboxes?
posted

Hi,

 

I need to loop through the WebDataTree in JavaScript and get a list of all "selected" checkboxes. I tried the below code. But it works only for the first entry in the loop.

 

for (var i=0; i < len; i++)

            {

                var node = nodes.getNode(i);

                m_strResult = m_strResult + node.get_text();

                var objChkBox = node._checkBox;

                m_strResult = m_strResult + " : " + node.get_selected() + "\n";

            }  

 

Here objChkBox  is null from the second node in the tree.

Also from the objChkBox  object how do I know if the checkbox is selected?

Please let me know what I am missing.

 

Thanks

Prasad

Parents
  • 3726
    Verified Answer
    posted

    Hi,

    you can get all the checked nodes in the tree by calling tree.get_checkedNodes(). It will return an array of $IG.Node objects.Then on each node you can call node.get_checkState() which can return 0-Unchecked, 1-Checked, 2-Partial depending on the check box mode you have configured.

    Hope this helps.

    Thanks,

    Lubomir

Reply Children
No Data