Filtering with a List of strings and not objects

Hello,

If I bind the multiselect dropdown to a list of objects with properties, everything works fine. In my case, I only have a list of strings and that makes the filtering not work. Do I need to set anything special on the MultiSelectFieldSettings Text and MultiSelectFieldSettings Value to make it filtering work with a list of strings?

private List ExistingTags { get; set; } = new List() { "Dove", "Multi-Specture", "Another Test", "more Testing" };
private List Tags { get; set; } = new List();
Edit:
Since my list is only strings and I'm not setting the Text and Value properties, the AllowCustomValue is not workign properly


4 Replies

RO Rodrigo February 21, 2020 03:51 PM UTC

Hello,
For some reason my edit removed some of my post so reposting.

If I bind the multiselect dropdown to a list of objects with properties, everything works fine. In my case, I only have a list of strings and that makes the filtering not work. Do I need to set anything special on the MultiSelectFieldSettings Text and MultiSelectFieldSettings Value to make it filtering work with a list of strings?

private List ExistingTags { get; set; } = new List() { "Dove", "Multi-Specture", "Another Test", "more Testing" };
private List Tags { get; set; } = new List();
<EjsMultiSelect TValue="IEnumerable<string>" Placeholder="Enter Tags" DataSource="@ExistingTags" @bind-Value="@OrganizationCraft.Tags" AllowFiltering="true" AllowCustomValue="true" Mode="@VisualMode.Box">
<MultiSelectFieldSettings Text="???" Value="???"></MultiSelectFieldSettings>
</EjsMultiSelect>
Edit:
Since my list is only strings and I'm not setting the Text and Value properties, the AllowCustomValue is not workign properly



SN Sevvandhi Nagulan Syncfusion Team February 24, 2020 08:42 AM UTC

Hi Rodrigo, 

Greetings from Syncfusion support. 

We have checked the reported requirement. We don't have string dataSource support for the multiselect component. So as of now, you can convert the string array to list type as mentioned below code snippet 

protected override void OnInitialized() 
    { 
        LocalData= CountryList.Select(x => new CountryData() 
        { 
            value = x 
        }).ToList(); 
    } 
    public class CountryData 
    { 
        public string value { get; set; } 
    } 

We have already considered it as feature, and it will be included in our upcoming volume-2 release. Which is expected to be rolled out on end of June 2020. We appreciate your patience until then. You can track the status of the feature in the below feedback link from below.    
  
  
Regards, 
Sevvandhi N 




NA Nathanael March 9, 2021 03:27 PM UTC

Did the String as a data source ever get updated in 2.0? Or Ever?


SN Sevvandhi Nagulan Syncfusion Team March 10, 2021 12:52 PM UTC

Hi Nathanael, 


Greetings from Syncfusion support. 


We included the fix for the reported issue ”String data source support to multiselect components  in the version “18.4.0.30”. We request you to update the nuget to our latest version "18.4.0.47" or the previous version. Please refer the below code example. 


 
<SfMultiSelect TValue="List<string>" TItem="string" DataSource="@data"></SfMultiSelect> 
 
 
@code { 
 
    public List<string> data = new List<string>() { "Australia", "Bermuda", "Canada" }; 
} 






Regards, 
Sevvandhi N 


Loader.
Up arrow icon