"multi" multi-select when ctrl key pressed

2 Answers 672 Views
MultiSelect
Caleb
Top achievements
Rank 1
Iron
Caleb asked on 16 Sep 2021, 06:28 PM | edited on 16 Sep 2021, 08:02 PM

We have a use case where users are choosing which values they'd like to concatenate together, from a list of options.

At times, they may need to concatenate the same thing more than once

Kendo's multiselect seems like the best component for this

... but I'm getting stuck on customizing it's behavior to allow the same value to repeat, when CTRL + CLICK takes place.

  • click - should add/remove choices per the usual
  • CTRL + CLICK should push the choice onto the multiselect, regardless if the multiselect already has that choice
    • Observe whether or not CTRL has been engaged
    • rewrite normal deselect handler to honor the required CTRL + CLICK behavior

Things are very close to working, but am unable to get the MultiSelect to dynamically update its value correctly, using Kendo's value() method.

 

Offending line of code attached in screenshot

and sample Dojo here -> https://dojo.telerik.com/ELeligEY/14


Am I missing something w/ Kendo's API? Should I be approaching this with a different Kendo component? 


UPDATE: from scrounging the forums, it appears an underlying architectural design means MultiSelect inherits from something that does not allow repeating values? https://www.telerik.com/forums/allow-duplicate-items

Help with this feature request would be much appreciated.
https://feedback.telerik.com/kendo-jquery-ui/1359475-allow-select-items-in-multiselect-multiple-times

Or guidance on how one might customize the Kendo Multiselect to achieve this kind of use case.

Help much appreciated.

2 Answers, 1 is accepted

Sort by
0
Accepted
Caleb
Top achievements
Rank 1
Iron
answered on 24 Sep 2021, 03:40 AM

Neli, thanks for suggesting AutoComplete - that is certainly part of the answer for our usecase.

Its default only reveals dropdown when typing on keyboard happens.

If anyone else needs to make it behave like multi-select:

  • configure your AutoComplete with a separator to allow multiple selections
  • on the HTML input your kendo AutoComplete binds against,  add a click handler that triggers the AutoComplete's search method, so the dropdown appears when clicking. AutoComplete doesn't expose an onFocus event configuration, so I had to workaround it by handling the native click event of the <Input> itself.

Sample dojo - https://dojo.telerik.com/aWEniHUt/19

If there's a better practice, please do share Neli. Thanks.

Neli
Telerik team
commented on 28 Sep 2021, 11:11 AM

Hi Caleb,

Thank you very much for the feedback and for the provided suggestion. I am sure it will be helpful to the other users in the Forum that have the same issue. 

Regards,

Neli

0
Neli
Telerik team
answered on 21 Sep 2021, 09:11 AM

Hi Caleb,

The MultiSelect, by design and concept, cannot enable duplication of selected items. The idea behind that is that the selection depends on the data items bound, and therefore, once an item is marked as selected the next action is to deselect it.  

I would suggest you take a look at the AutoComplete Demos, as the AutoComplete widget allows selecting duplicate values.

https://demos.telerik.com/kendo-ui/autocomplete/index

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
MultiSelect
Asked by
Caleb
Top achievements
Rank 1
Iron
Answers by
Caleb
Top achievements
Rank 1
Iron
Neli
Telerik team
Share this question
or