Cannot rerender kendo.ui.DropDownTree after dynamically changing tagMode

1 Answer 161 Views
DropDownTree
Cathal
Top achievements
Rank 1
Cathal asked on 23 Sep 2022, 10:41 AM

Hi,

I'm tryign to dynamically change the tagMode of a kendo.ui.DropDownTree as a user selects more or less items but the control does not refresh/rerender

 

Below is a sample of the code I have tried...

 var ddt = $(id).data('kendoDropDownTree');
        var maxSelectedItemsDisplayedInSingleTagMode = 3;
        let selectedValues = ddt.value();
        let currentTagMode = ddt.options.tagMode;
        let newTagMode = currentTagMode;

        newTagMode = selectedValues.length <= maxSelectedItemsDisplayedInSingleTagMode ? "multiple" : "single";
        if (newTagMode != currentTagMode) {
            ddt.value([])
            ddt.setOptions({
                tagMode: newTagMode
            });
            ddt.value(selectedValues);
        }

Something similar does work for the kendo.ui.MultiSelect but I cannot get it to play ball for kendo.ui.DropDownTree

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 28 Sep 2022, 07:49 AM

Hello Cathal,

Indeed, currently, the tagMode in the DropDownTree could not be changed using the setOptions method.

However, I will recommend taking a look at the Feature Request linked below. In the initial post of the item, you will find a Dojo example demonstrating a possible approach on how the tagMode can be changed at runtime.

https://feedback.telerik.com/kendo-jquery-ui/1450912-functionality-to-switch-tagmode-dynamically-and-also-auto-selecting-all-parent-s-children-if-parent-node-is-checked

I hope this helps. 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Cathal
Top achievements
Rank 1
commented on 29 Sep 2022, 11:37 AM

Thanks Neli, I used the dojo examle as a basis for my solution and got there in the end!
Tags
DropDownTree
Asked by
Cathal
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or