Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
This is related to the issue specified here:
https://www.syncfusion.com/forums/155340/autocomplete-autoformat-display-text-vs-search-text-binding
Basically, what is missing is the ability to specify what property of the searched data to apply to the bound field.
For example:
I want to be able to type and search a sport by name, and the ID of the sport to bind to my bound object property (myBoundSportObject.SportId).
e.g. If I type in "Badminton" I expect myBoundSportObject.SportId to be set to "102"
public List<Game> Games = new List<Game>()
{
new Game(){ ID= "101", SportName= "American Football" },
new Game(){ ID= "102, SportName= "Badminton" },
};
<SfAutoComplete TValue="string" TItem="Game" TValue="string" Placeholder="Find game..." DataSource="@Games" @bind-Value="@myBoundSportObject.SportId">
<AutoCompleteFieldSettings Value="ID" Text="SportName" />
'Value' = the datasource property that is searched when typing happens AND the output bound field
'Text' = the datasource property that is displayed when typing happens
So, in this example I have to type '101' to see 'American Football'. That's counter-intuitive.
'Value' and 'Text' have to always be the same, otherwise the typing doesn't make sense.
So I have to do this, to make the typing work property:
<AutoCompleteFieldSettings Value="SportName" Text="SportName" />
But then, my bound value has to always be the SportName, not the ID.
Can I suggest simply adding a new attribute to AutoCompleteFieldSettings which specifies what property of the bound object to bind to?
e.g.
<AutoCompleteFieldSettings Value="ID" Text="SportName" BindTo="ID" />