Unselectable Nodes.

5 posts, 1 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 13 Oct 2009 Link to this post

    Is it possible to have a node, that has child nodes that is both unselectable and expandable?

    I'm using a node as a container on a treeview for a number of similar items.

    It makes no sense, in the context of the software, to select the containing node but the user obviously has to be able to expand it to get at the child nodes.

    Ideally, the system wouldn't react to a click on such a node and the visual appearance of it wouldn't change.

    Is such a scenario possible with RadTreeView?

    --
    Stuart
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Oct 2009 Link to this post

    Hi Stuart,

    Try attaching OnClientNodeClicking event to RadTreeView and check for the node text which clicked and cancel the event accordingly using args.set_cancel(true) method.

    JavaScript:
     
    <script type="text/javascript"
        function OnClientNodeClicking(sender, args) { 
            if (args.get_node().get_text() == "Softwares") { 
                args.set_cancel(true); 
            } 
        } 
    </script> 

    -Shinu.
  3. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 13 Oct 2009 Link to this post

    Hmm. Good idea; I'll give that a go.

    TVM.
  4. Phi Kong
    Phi Kong avatar
    7 posts
    Member since:
    Jan 2008

    Posted 14 Oct 2009 Link to this post

    Thank you Shinu, exactly what i was looking for.

    Phi
  5. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 15 Oct 2009 Link to this post

    That works a treat.

    What others may notice, however, is that the highlighing of the node still occurs on mouseover.

    For nodes that I don't want to allow selection on, I set the CssClass to NoNodeSelect which is defined as
    .NoNodeSelect  
        color#000 !important; 
        border-colorwhite !important; 
        backgroundnone !important; 

    Of course, YMMV.

    --
    Stuart
Back to Top