How to get multiselect to show default data

We are using ejs-multiselect with remote data that we are fetching via AJAX (axios), but we are not able to get default data in the dropdown list.

On `filtering` event we are making the AJAX request and calling function `e.updateData` which updates the popup list, but it is not changing `dataSource`.

On 'open' event we want to make the same request and update the popup list with this without updating dataSource, how do we do this?

Also on `filtering` event if event.text is empty, event.updateData() does not update the popup list. How can we update the list?

thanks


1 Reply

SP Sureshkumar P Syncfusion Team June 30, 2022 01:42 PM UTC

Hi Ash,

Query 1: On `filtering` event we are making the AJAX request and calling function `e.updateData` which updates the popup list, but it is not changing `dataSource`.

In our filtering method the updateData using only for displaying the filtered data in the popup element. This will not affect the component datasource property.


Query 2: On 'open' event we want to make the same request and update the popup list with this without updating dataSource, how do we do this?

In our component will not load the data into the component without updating the datasource property. But after filtering the data using custom filtering the filtered list is displayed in the popup element using updateData method.


Query 3: Also on `filtering` event if event.text is empty, event.updateData() does not update the popup list. How can we update the list?

We suggest you return the default data from your backend service by checking the filtering event argument.text as empty and update the result using updateData method.

Also, we suggest you update the component datasource property with your default data to resolve your issue.

Regards,

Sureshkumar P


Loader.
Up arrow icon