We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MultiSelect ignores <option selected="selected">; separate call to value: Json deserialize Ids required

Thread ID:

Created:

Updated:

Platform:

Replies:

142479 Feb 5,2019 09:22 PM UTC Feb 6,2019 11:11 AM UTC ASP.NET Core - EJ 2 2
loading
Tags: MultiSelect Dropdown
Stefan
Asked On February 5, 2019 09:22 PM UTC

I was (happily) surprised to see that I can generate a MultiSelect on top of an existing having options selected.
Extract (pseudo code):

Stefan
Replied On February 5, 2019 09:27 PM UTC

Apparently I should not use tags in the post, they don't appear to be escaped. Trying again:

I was (happily) surprised to see that I can generate a MultiSelect on top of an existing select element, which is generated through Razor.
However, the control does not honour any option selected="selected" ..="" values, the input is rendered blank.
In order to get it to work, I had to instantiate it with a JSON serialized array of the selected options and wonder why that should be necessary.
Full sample is here:
https://stackblitz.com/edit/js-4nhpad
As you can see, the input in the sample is blank, despite the HTML output for the having options selected.

Extract (pseudo code):
select id="x" multiple
option 1
option 2 selected
option 3 selected
option 4

let xMultiSelect = new ej.dropdowns.MultiSelect({
placeholder: "Choose Option",
mode: "Box",
//value: @JsonHelper.Serialize(Model.xIds) // xIds is int[]; Why is this required? Why does it pick up options, but not values from selected?
}).appendTo("#x");

Prince Oliver [Syncfusion]
Replied On February 6, 2019 11:11 AM UTC

Hi Stefan, 

Thank you for contacting Syncfusion support. 

We were able to replicate the reported issue in our end. We have confirmed this as bug in the multiselect component. The fix for this issue will be included in our upcoming patch release scheduled on the mid of February 2019. You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/4608  

Until then we suggest you use the value property to preselect the value in the component during the rendering time. Kindly refer to the following link for the sample. 


Kindly refer to the following API documentation for further reference : https://ej2.syncfusion.com/javascript/documentation/api/multi-select/#value 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon