Set selected Values dyanamically on page load to mutiselectDropdown

mutiselectDropdown list items will load on API call called on filtering event. We are not able to add selected items to default items in control
Ex: AUS, NZ is default selected in control and user search for "IN " and selects IND we need to and add IND to selected fields.
All the data when filting loads from API on text enterred by user. Please let me know how we can add selected iteam to pre loaded items


1 Reply 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team May 20, 2021 01:37 PM UTC

Hi kranthi, 

Thanks for contacting Syncfusion support. 

As per your reported scenario, we have loaded the Multiselect list items in the filtering event. Here when selecting the items from the popup, the selected items will automatically updated in the value property of Multiselect. By default, the dynamically selected items will be added to the pre-selecetd items. For your convenience, we have included a sample below. 

public onSelect() { 
    setTimeout(() => { 
      console.log('The selected values are : ' + this.mulObj.value); 
    }); 
} 

 


Also, as per your requirement, the datasource loads only when filtering, therefore when you are updating the preselected value to the component, we request that you share the details. If you're loading the preselected value to the component on initial rendering, share the code snippet that demonstrates what you have been doing it. 

Kindly check with the above sample, if issue still exists, please revert us with below details.  

  1. Share control rendering code snippet along with assigning preselect  value.
  2. If possible replicate the issue in the above provided sample.
  3. Provide issue replicating video demonstration.

Regards, 
Ponmani M 


Marked as answer
Loader.
Up arrow icon