This is a migrated thread and some comments may be shown as answers.

Unselectable Nodes.

4 Answers 142 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 13 Oct 2009, 12:09 PM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Oct 2009, 12:47 PM
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.
0
Stuart Hemming
Top achievements
Rank 2
answered on 13 Oct 2009, 01:04 PM
Hmm. Good idea; I'll give that a go.

TVM.
0
Phi Kong
Top achievements
Rank 1
answered on 14 Oct 2009, 03:48 PM
Thank you Shinu, exactly what i was looking for.

Phi
0
Stuart Hemming
Top achievements
Rank 2
answered on 15 Oct 2009, 06:44 AM
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
Tags
TreeView
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Stuart Hemming
Top achievements
Rank 2
Phi Kong
Top achievements
Rank 1
Share this question
or