Answer:
<SfAutoComplete TValue="string" TItem="Countries" Placeholder="e.g. Australia" CssClass="e-multi-column" DataSource="@Country"> <AutoCompleteFieldSettings Value="Name">AutoCompleteFieldSettings> <DropDownListTemplates TItem="Countries"> <HeaderTemplate> <table><tr><th class="e-text-center">Nameth><th width="240px">Positionth>tr>table> HeaderTemplate> <ItemTemplate> <table><tbody><tr><td class="e-text-center">@((context as Countries).Name)td><td width="240px">@((context as Countries).Job)td>tr> tbody>table> ItemTemplate> DropDownListTemplates> SfAutoComplete>
<style> .e-multi-column.e-ddl.e-popup.e-popup-open td { border: 1px solid rgba(0, 0, 0, 0.125); } style> |
How can I search multiple columns?
In this example I can search for "Australia" and I see "Australia" as 'Name' and "Team Lead" as 'Position'. But I can not search for "Team Lead".
When I search multiple columns, I expect this entry to show up, no matter if I search for "Australia" or "Team".
How can this be done?
Thank you
public async Task OnFiltering(FilteringEventArgs args)
{
args.PreventDefaultAction = true;
var pre = new WhereFilter();
var predicate = new List<WhereFilter>();
predicate.Add(new WhereFilter() { Condition = "or", Field = "Name", value = args.Text, Operator = "contains", IgnoreAccent = true, IgnoreCase = true });
predicate.Add(new WhereFilter() { Condition = "or", Field = "Job", value = args.Text, Operator = "contains", IgnoreAccent = true, IgnoreCase = true });
predicate.Add(new WhereFilter() { Condition = "or", Field = "Code", value = args.Text, Operator = "contains", IgnoreAccent = true, IgnoreCase = true });
pre = WhereFilter.Or(predicate);
var query = new Query().Where(pre);
await this.autoObj.Filter(Country, query);
} |
Hi Sevvandhi,
thanks for the quick answer. Just what I was looking for, works like a charm.
Regards,
Thomas