Exclusive group checkboxes

5 posts, 0 answers
  1. Miky
    Miky avatar
    13 posts
    Member since:
    Dec 2011

    Posted 20 Feb 2013 Link to this post

    Hi,

    I was wondering if it's possible to do something like this using the TriState checkboxes.

    Let's say I have this specific tree, no more than these two levels :
    (_) Group 1
       +------- [_] Item 1 
       +------- [_] Item 2
       +------- [_] Item 3
       +------- [_] Item 4
    (_) Group 2
       +------- [_] Item 5
       +------- [_] Item 6
       +------- [_] Item 7
       +------- [_] Item 8

    Case:
    A user could chose one to many items from group 1, or one to many items from group 2. But when they check the group 2 or the items 5 to 8, all the items from group 1 get unckecked.  Or when they check group 1 or any item from 1 to 4, all items from group 2 gets unchecked.

    Can this be done easely or I have to catch some client event and program all the JavaScript manually ?

    Also, is it possible to have a multi-column items ?

    Kind regards,

    Michel

  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 21 Feb 2013 Link to this post

    Hello Michael,

    Thank you for contacting Telerik Support.

    Straight to the question. I am afraid that it is not possible to achieve such scenario with the RadDropDownTree control.  The TriState gives you the ability to check child nodes and when you uncheck some of them the parent is unchecked too. The control relays on user interaction in order to add and remove entries. In order to template the DropDownNodes you could review the following demo as a reference.

    I will be glad to assist you again.

    All the best,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Miky
    Miky avatar
    13 posts
    Member since:
    Dec 2011

    Posted 25 Feb 2013 Link to this post

    Hi,

    here is how you do it for now.

    <script type="text/javascript">
     
        function Added(source, args) {
            var entries = source.get_entries();
            for (var i = 0 ; i<entries.get_count() ; i++) {
                var entry = entries.getEntry(i);
                if (args.get_entry().get_fullPath().split("/")[0] != entry.get_fullPath().split("/")[0]) {
                    for (var j = 0; j < source._manager._checkedNodes.length; j++) {
                        if (source._manager._checkedNodes[j]._properties._data.value == entry._value) {
                            source._manager._checkedNodes[j].uncheck()
                            break;
                        }
                    }
                }
            }
        }
      
    </script>

    <telerik:RadDropDownTree ID="RadDropDownTree1" RenderMode="Lightweight" runat="server"
        CheckBoxes="TriState" OnClientEntryAdded="Added" Width="400px">
        <DropDownSettings Width="400px" />
    </telerik:RadDropDownTree>


    Kind regards,

    Michel T Dallaire
  5. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 28 Feb 2013 Link to this post

    Hello Michel,

    I am glad the you found out a workaround that works for you. My only concern is that the public API of the control is not used. For the next release we are going to expose Remove methods on the Entries collections at the client and server side also and parent information for the added entry.

    Regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Miky
    Miky avatar
    13 posts
    Member since:
    Dec 2011

    Posted 28 Feb 2013 Link to this post

    Hi Peter,

    I agree with you, but no matter how hard I looked, there was nothing in the public API offered to do the job.

    We understand we're gonna have to upgrade the code in a near future, but for a mear 10 lines of codes, I don't think it will be a big challenge.  :-)

    Kind regards,

    Michel T Dallaire
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017