Erase search text on multi-select with virtualization

1 Answer 98 Views
MultiSelect
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Lee asked on 05 May 2023, 08:05 PM | edited on 05 May 2023, 09:26 PM

I have a kendo multiselect with virtualization set to true. I want to clear out the data from the search input after each item is selected so the user can start a new search. I tried this solution but found a bug. In my example, if the user selects 1 and then 20, the selected items get cleared and the multiselect becomes unusable from that point forward. The x won't clear anything and you can't select anything. How do I fix this?

Here is a dojo showing the problem

Failed Attempt:
I attempted to fix this by adding .trigger("input") to the e.sender.input.val("") line but that ends up creating duplicates of the same item selected and causes occasional errors like this in the console and doesn't clear the box: 

Uncaught TypeError: r.select(...).done is not a function
    at init._removeTag (kendo.all.js:311085:87)
    at HTMLSpanElement.<anonymous> (kendo.all.js:311085:87)
    at Function.each (jquery.min.js:2:2976)
    at fn.init.each (jquery.min.js:2:1454)
    at init._clearValue (kendo.all.js:311085:87)
    at HTMLSpanElement.dispatch (jquery.min.js:2:43090)
    at v.handle (jquery.min.js:2:41074)

 

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 10 May 2023, 10:50 AM

Hello Lee,

Could you please check if the suggestion provided in the other forum thread where the issue is discussed will resolve the problem on your side?

https://www.telerik.com/forums/multiselect-with-autoclose-false---delete-input-text-keeps-the-items-selected#4857665

For convenience, below you will find the related code:

change: function (e) {
          e.sender.input.val("");
          e.sender.search('');
},

I hope this helps.

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
MultiSelect
Asked by
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Answers by
Neli
Telerik team
Share this question
or