Blazor Sfmultiselect Custom data adaptor not working

Hello Team,

I have a search box when entered data will trigger an API call to get some list. I am using SFMultiselect because we need multiple selections. I tied my sfmultiselect to the custom data adaptor. The problem is my ReadAsync function is not getting the characters that i am typing in the multiselect box. I am posting my code below.


<SfMultiSelect @ref="CompanyAutoComplete_Add" TValue="string" TItem="QuoteOutput">

<SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>

<MultiSelectFieldSettings Value="Description" Text="Description"></MultiSelectFieldSettings>

</SfMultiSelect>


public class CustomAdaptor : DataAdaptor

{

public override async Task<object> ReadAsync(DataManagerRequest dm, string key = null)

{

var DataSource = new List<QuoteOutput>();

var searchString = dm.Where.FirstOrDefault()?.value;

if (searchString != null)

{

DataSource = await _http.GetFromJsonAsync<List<QuoteOutput>>($"api/trades/searchCompanies/{searchString}");

}

dm = null;


return (object)DataSource;

}

}



The "DataManagerRequest" above is null when i type into the multi select box.




1 Reply 1 reply marked as answer

UD UdhayaKumar Duraisamy Syncfusion Team April 27, 2022 02:44 PM UTC

Hi Aditya,


We have prepared a sample for the requested requirement and attached it below for reference. Also, we have attached the documentation for further reference.


Screenshot :



Documentation Link : https://blazor.syncfusion.com/documentation/multiselect-dropdown/data-source#custom-adaptor


Regards,

Udhaya Kumar D



Attachment: Blazor_Server_d0437e79.zip

Marked as answer
Loader.
Up arrow icon