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

Exclusive group checkboxes

4 Answers 98 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Miky
Top achievements
Rank 1
Miky asked on 20 Feb 2013, 09:41 PM
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

4 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 21 Feb 2013, 01:12 PM
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.
0
Miky
Top achievements
Rank 1
answered on 25 Feb 2013, 08:38 PM
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
0
Peter Filipov
Telerik team
answered on 28 Feb 2013, 08:12 AM
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.
0
Miky
Top achievements
Rank 1
answered on 28 Feb 2013, 01:04 PM
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
Tags
DropDownTree
Asked by
Miky
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Miky
Top achievements
Rank 1
Share this question
or