Multiselect fileter item stays on datasrouce change

2 posts, 0 answers
  1. Valentina
    Valentina avatar
    2 posts
    Member since:
    Dec 2016

    Posted 25 Sep Link to this post

    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.

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1263 posts

    Posted 27 Sep Link to this post

    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.
Back to Top