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

Treeview checkbox enabled status

6 Answers 92 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 24 Mar 2010, 01:29 PM
Hi,

With treeviews that have checkboxes on them is there a simple way to turn on and off the ability to check/uncheck the boxes?

I've tried setting the nodes to enabled=false but when doing that the text goes grey. 

I want to turn my admin form into a non admin form with as little fuss as possible.  Obviously I could use a node template but then the complexity of the page ramps up for a basic requirement.

I'm just hoping that I've missed some basic setting!

Regards,

Jon

6 Answers, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 24 Mar 2010, 01:49 PM

I've just found that I can change the font colour for the text using some CSS as shown below. 

It would be nice though if there was a way to enable/disable editing from a single flag on the tree.

Regards,

Jon

<style type="text/css">    
.RadTreeView_Web20 .rtDisabled .rtIn    
{    
    color: black !important;    
}    
</style>  
0
Veronica
Telerik team
answered on 24 Mar 2010, 04:49 PM
Hello Jon,

Unfortunately at this moment there is no property to disable the ability of the checkbox to check/uncheck.

Anyway the solution you tried seems very good. I was going to suggest the same thing - make the whole Node disabled and only to change it's CssClass.  

Another way may be to use the Checkable property. When set to false the checkbox disappears for particular Node which has this property:

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1.1" Checkable="false">
                       </telerik:RadTreeNode>

Hope this helps.

Kind regards,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jon
Top achievements
Rank 1
answered on 24 Mar 2010, 05:21 PM
Hi Veronica,

Yes the solution does work quite well. 

WOuld it be possible to add in a request to have a tree level flag for allow/disallow edits?  That would be very helpful.  I think that my application uses roughly 15 pages where I have the tree in place for multi select admin functionality and there is a lot more to do on that.  Having the option at the tree level would reduce my code base a little.

Regards,

Jon
0
Veronica
Telerik team
answered on 29 Mar 2010, 03:39 PM
Hi Jon,

Actually I've found one more solution to disable checkboxes. Just subscribe to the OnClientNodeChecking event and cancel it:

<telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="true" OnClientNodeChecking="OnClientNodeCheckingHandler">

<script type="text/javascript">
       function OnClientNodeCheckingHandler(sender, args) {
           args.set_cancel(true);
       }
   </script> 

I've attached the code as a .zip file.

Anyway could you please explain in details what do you want to achieve in your previous post. I did not understand your requirements.


All the best,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jon
Top achievements
Rank 1
answered on 29 Mar 2010, 04:32 PM
Hi Veronica,

That's a very good way of doing it - minimal effort to implement!

Yes I was asking for a new flag that could be applied to a RadTree - perhaps ReadOnly that would disable the ability to tick/untick any checkboxes shown but at the same time not show the whole tree as disabled (grey). 

Could that be added as a feature request?

It's obviously easy enough to implement using your method but just a hassle adding extra code to all the pages where it's needed. 

I think I'll soon need a WorkAround.JS file for all the common work arounds ;)

Have a good evening.

Regards

Jon
0
Veronica
Telerik team
answered on 30 Mar 2010, 10:17 AM
Hello Jon,

Thank you for your feedback.

We will consider your suggestion and see if it is appropriate to add it in one of the next releases.

All the best,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or