8000 how to set category id for Searchmethod · Issue #307 · Blazored/Typeahead · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

how to set category id for Searchmethod #307

Open
mousavi-sh opened this issue May 28, 2023 · 1 comment
Open

how to set category id for Searchmethod #307

mousavi-sh opened this issue May 28, 2023 · 1 comment
Labels
Question Question about this project Triage Issue needs to be triaged

Comments

@mousavi-sh
Copy link

Dear
I uses multi blazoredtypeahead component in one page with one searchmethod function.
i need a unique Id to category data for each component.

private async Task<IEnumerable> SearchList(string searchText)
{
return await Task.FromResult(newList.Where(x => x.categoryId=listId && x.Name.Contains(searchText)).ToList());
}
how to pass ListId to this function?

@mousavi-sh mousavi-sh added Question Question about this project Triage Issue needs to be triaged labels May 28, 2023
@palktonderAtpowelno
Copy link

You can use a delegate as the SearchMethod and set the id per instance:

<BlazoredTypeahead SearchMethod="(searchString) => SearchList(searchString, 44)"

private async Task SearchList(string searchText, int listId)
{
return await Task.FromResult(newList.Where(x => x.categoryId=listId && x.Name.Contains(searchText)).ToList());
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question Question about this project Triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants
0