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

Clearing values is selecting additional values

4 Answers 101 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Grant asked on 12 Aug 2020, 07:58 AM

Hi, 

As my title says, when I clear selected values in the input, additional values selected.

See Dojo: https://dojo.telerik.com/UgOVISOL

Duplicate:
1) Open the widget and select an element under the Customer Location group
2) Close the widget
3) Click the X button on the tag to remove the selected Customer Location.

See how it adds an additional value to the selected list. This is somehow linked to the filtering in the change callback because when I remove the change callback, it works fine. N.B. this only happens when clearing the value using the X, if the value is deselected, all is fine

The desired behaviour is that when a customer location is selected, the customer accounts in the datasource are filtered by the selected customer location. This part is working though.

Thanks, 
Grant

4 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 14 Aug 2020, 07:57 AM

Hello Grant,

Thank you for the example. 

I am currently reviewing it and will get back to you shortly with further information.

Regards,
Martin
Progress Telerik

0
Accepted
Martin
Telerik team
answered on 14 Aug 2020, 10:58 AM

Hello Grant,

I managed to get the example working correctly by adding the following line after filtering the dataSource:

e.sender.setDataSource(e.sender.dataSource)

Here is the modified example for reference.

Let me know how that works for you.

Regards,
Martin
Progress Telerik

0
Grant
Top achievements
Rank 3
Iron
Iron
Iron
answered on 14 Aug 2020, 11:32 AM

Hi Martin,

Thanks for the help.

Could you please explain what is happening to cause this and why the DS has to be reset?

Thanks, 
Grant

0
Martin
Telerik team
answered on 18 Aug 2020, 11:34 AM

Hello Grant,

A possible reason is that when the Multiselect filters the dataSource, the items' indices are not getting updated. So when it tries to clear an item, it is actually with another index, and is therefore added. Using the setDataSource seems to re-map the indices and thus resolves the problem.

Regards,
Martin
Progress Telerik

Tags
MultiSelect
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Martin
Telerik team
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or