treeview with checkbox on some levels

2 posts, 0 answers
  1. Bjørn
    Bjørn avatar
    3 posts
    Member since:
    Jan 2011

    Posted 18 May 2011 Link to this post

    Is it possible to make a treeview with checkboxes, but only on certain levels?
    like not on first and second level, but on 3 or 4 level/ or all other levels below second level.

    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 May 2011 Link to this post

    Hello Bjorn,

    One approach is to hook onClientLoad event and loop through each nodes. There you can check for the node level and access the checkbox element and hide it . Here is a same script which hides the first level CheckBoxes.

    Javascript:
    <script type="text/javascript">
    function OnClientLoad(sender, args)
      {
            for (var i = 0; i < sender.get_allNodes().length; i++)
            {
                if (sender.get_allNodes()[i].get_level() == "1")
                {
                    sender.get_allNodes()[i].get_checkBoxElement().style.display = "none";
                }
            }
        }
    </script>

    Thanks,
    Princy.
Back to Top