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

MultiSelectFor removing preselected items when filtering additional item

1 Answer 138 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
bman
Top achievements
Rank 1
bman asked on 24 Jun 2015, 01:46 AM

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.

 

 

 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 25 Jun 2015, 02:23 PM
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
Tags
MultiSelect
Asked by
bman
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or