Hi,I'm not able to filter a dropdownlist, whose datasource is an ordered list.The problem may be in the list 'OrderBy', but I really don't understand why ...Below is the code I am using.Can you help, please?Thanks,Fausto<div class="dropdown m-3"><SfDropDownList ID="Task_PatientId"@ref="ddlPatients"TValue="int"TItem="Patient_Minimized" Width="400px"AllowFiltering="true"FilterBarPlaceholder="Doente"FilterType="Syncfusion.Blazor.DropDowns.FilterType.Contains"ShowClearButton="true"DataSource="@patientList" Placeholder="Doente"@bind-Value="@selectedTask.IdCliente"><DropDownListTemplates TItem="Patient_Minimized"></DropDownListTemplates><DropDownListEvents TValue="int"TItem="Patient_Minimized"ValueChange="onChangePatient"Filtering="OnFilter"></DropDownListEvents><DropDownListFieldSettings Text="Nome" Value="IdCliente"></DropDownListFieldSettings></SfDropDownList></div>// Codeprotected IEnumerable<Patient_Minimized> patientList; // = new List<Patient_Minimized>();protected SfDropDownList<int, Patient_Minimized> ddlPatients;protected override async Task OnInitializedAsync(){//CreateDummyData();CurrentUser = (await authenticationStateTask).User;var user = await _UserManager.FindByNameAsync(CurrentUser.Identity.Name);IsUserDoctor = user.IsDoctor;doctorID = user.CodMedico;tasksList = await GetAllTasksAsync();patientList = await GetDoctorPatients(doctorID);}protected async Task<IEnumerable<Patient_Minimized>> GetDoctorPatients(int doctorCode){var patients = await patientsService.FindDoctorPatientsAsync(doctorCode); // list comes encryptedif (!output.Any() || output == null){sErrorMsgs = new List<string>() { "Médico não tem doentes registados. Verifique, p.f." }; // Doctor has no patients assigned...ErrorVisibility = true;EditTaskDialogVisibility = false;}List<Patient_Minimized> patientListDecoded = new List<Patient_Minimized>();foreach (var patient in patients){patientListDecoded.Add(new Patient_Minimized(){IdCliente = patient.IdCliente, // Patient IDNome = _securityProvider.Decrypt(patient.Nome) // Patient Name});}//List decoded and ordered by patient name// TODO -- after ordering, patient dropdown does not allow searchreturn patientListDecoded.OrderBy(p => p.Nome);}protected async Task OnFilter(FilteringEventArgs args){args.PreventDefaultAction = true;var query = new Query().Where(new WhereFilter() { Field = "Nome", Operator = "contains", value = args.Text, IgnoreCase = true });query = !string.IsNullOrEmpty(args.Text) ? query : new Query();await ddlPatients.Filter(patientList, query);}
Hi,I'm not able to filter a dropdownlist, whose datasource is an ordered list.The problem may be in the list 'OrderBy', but I really don't understand why ...Below is the code I am using.Can you help, please?Thanks,Fausto<div class="dropdown m-3"><SfDropDownList ID="Task_PatientId"@ref="ddlPatients"TValue="int"TItem="Patient_Minimized" Width="400px"AllowFiltering="true"FilterBarPlaceholder="Doente"FilterType="Syncfusion.Blazor.DropDowns.FilterType.Contains"ShowClearButton="true"DataSource="@patientList" Placeholder="Doente"@bind-Value="@selectedTask.IdCliente"><DropDownListTemplates TItem="Patient_Minimized"></DropDownListTemplates><DropDownListEvents TValue="int"TItem="Patient_Minimized"ValueChange="onChangePatient"Filtering="OnFilter"></DropDownListEvents><DropDownListFieldSettings Text="Nome" Value="IdCliente"></DropDownListFieldSettings></SfDropDownList></div>// Codeprotected IEnumerable<Patient_Minimized> patientList; // = new List<Patient_Minimized>();protected SfDropDownList<int, Patient_Minimized> ddlPatients;protected override async Task OnInitializedAsync(){//CreateDummyData();CurrentUser = (await authenticationStateTask).User;var user = await _UserManager.FindByNameAsync(CurrentUser.Identity.Name);IsUserDoctor = user.IsDoctor;doctorID = user.CodMedico;tasksList = await GetAllTasksAsync();patientList = await GetDoctorPatients(doctorID);}protected async Task<IEnumerable<Patient_Minimized>> GetDoctorPatients(int doctorCode){var patients = await patientsService.FindDoctorPatientsAsync(doctorCode); // list comes encryptedif (!output.Any() || output == null){sErrorMsgs = new List<string>() { "Médico não tem doentes registados. Verifique, p.f." }; // Doctor has no patients assigned...ErrorVisibility = true;EditTaskDialogVisibility = false;}List<Patient_Minimized> patientListDecoded = new List<Patient_Minimized>();foreach (var patient in patients){patientListDecoded.Add(new Patient_Minimized(){IdCliente = patient.IdCliente, // Patient IDNome = _securityProvider.Decrypt(patient.Nome) // Patient Name});}//List decoded and ordered by patient name// TODO -- after ordering, patient dropdown does not allow searchreturn patientListDecoded.OrderBy(p => p.Nome);}protected async Task OnFilter(FilteringEventArgs args){args.PreventDefaultAction = true;var query = new Query().Where(new WhereFilter() { Field = "Nome", Operator = "contains", value = args.Text, IgnoreCase = true });query = !string.IsNullOrEmpty(args.Text) ? query : new Query();await ddlPatients.Filter(patientList, query);}