MultiSelectFor removing preselected items when filtering additional item

2 posts, 0 answers
  1. bman
    bman avatar
    6 posts
    Member since:
    May 2007

    Posted 23 Jun 2015 Link to this post

    kendo 2015.1.318 \ JQuery 1.10.2 \ MVC 5

    @(Html.Kendo().MultiSelectFor(m => m.SelectedUsers)
    .Name("SelectedUsersBox")
    .DataTextField("DisplayName")
    .DataValueField("UserId")
    .BindTo(Model.AllUsers)
    )

    When there are pre-existing items in the box and additional items are added (by typing in some letters and allowing the list to be filtered), some of the existing items which don't match the filter will be removed from the underlying select list. This causes empty items to be posted with the form.

    For example a preexisting list of Andrea, Bob. The underlying select list looks like:

    <select name="SelectedUsersBox" id="SelectedUsersBox" style="display: none;" multiple="multiple" data-role="multiselect">
        <option value="1" selected="selected">Andrea</option>
        <option value="2">Allan</option>
        <option value="3" selected="selected">Bob</option>
    </select>

    If the letter "A" is typed into the box, "Andrea" is shown highlighted and "Allan" is not highlighted. As soon as the choice list is filtered to names beginning with "A", the underlying select list looks like (no name is selected\clicked):

    <select name="SelectedUsersBox" id="SelectedUsersBox" style="display: none;" multiple="multiple" data-role="multiselect">
        <option value="1" selected="selected">Andrea</option>
        <option value="2">Allan</option>
        <option selected="selected"/>
    </select>

    If "Allan" is selected the list looks like:

     <select name="SelectedUsersBox" id="SelectedUsersBox" style="display: none;" multiple="multiple" data-role="multiselect">
        <option value="1" selected="selected">Andrea</option>
        <option value="2" selected="selected">Allan</option>
        <option selected="selected"/>
    </select>

    If the form is posted at this point "Bob" is not one of the selected choices. In fact, one of the selected choices has no value!

    Is this expected behavior? Am I missing a configuration\setting\property on the MultiSelectFor?

     

    PS: If the user clicks on the box which brings up the entire menu, the select list is rebound and all of the values show up. Unfortunately, having a person click on the box to bring up the menu before submission is not a suitable solution.

     

     

     

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 25 Jun 2015 Link to this post

    Hello bman,

    In 2015.1.318, MultiSelect widget has several bugs that caused the described issues. I would suggest you upgrade to the latest official release (2015.2.624) and let me know if the problem still persists.

    Regards,
    Georgi Krustev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top