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

Multiselect fileter item stays on datasrouce change

1 Answer 49 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
NTH
Top achievements
Rank 1
NTH asked on 25 Sep 2017, 06:06 PM

So I will try to explain my problem.

I have 2 multiselect components where second is filtered by first if first is set (if first is not set second one has full data access).

Lets say first data source is this ['a','b'].

and second data source is [1,2,3,4,5].

If selected item of first multiselect is 'a', second data source becomes [1,2,3]

If selected item of first multiselect is 'b' second data source becomes [4,5]

If there is none selected items in first multiselect then second data source becomes [1,2,3,4,5]

When i select item in second multiselect, lets say 2, and after that select in first multiselect item 'b', second multiselected items becomes [4,5] and old value 2 is gone. That is what i want and that is how it works now.

 

But my problem is when i *search* in second multiselect for an item 2, and after that i choose 'b' in first multiselect, that old value is still selected, he is not in options, and he is not in datasoruce but he is still selected and on submit i get his value too.

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 27 Sep 2017, 01:29 PM
Hello Valentina,

We can suggest clearing the second MultiSelect's value whenever an item is selected in the first MultiSelect. For example see this dojo. In multiselect1's change event handler multiselect2's value is cleared prior to setting its dataSource, by calling its value method and passing an empty array:
ms2.value([]);


Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MultiSelect
Asked by
NTH
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or