Treeview checkbox enabled status

7 posts, 0 answers
  1. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 24 Mar 2010 Link to this post

    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

  2. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 24 Mar 2010 Link to this post

    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>  
  3. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 24 Mar 2010 Link to this post

    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.
  4. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 24 Mar 2010 Link to this post

    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
  5. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 29 Mar 2010 Link to this post

    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.
  6. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 29 Mar 2010 Link to this post

    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
  7. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 30 Mar 2010 Link to this post

    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.
Back to Top