2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

Add custom search context for "category"

This commit is contained in:
Oliver Walters
2021-02-13 00:40:21 +11:00
parent 36f0d7b120
commit 858464d301
4 changed files with 32 additions and 89 deletions

View File

@ -86,9 +86,15 @@ class InvenTreeModel {
// Search this Model type in the database
Future<List<InvenTreeModel>> search(BuildContext context, String searchTerm) async {
Future<List<InvenTreeModel>> search(BuildContext context, String searchTerm, {Map<String, String> filters}) async {
final results = list(context, filters: {"cascade": "true", "search": searchTerm});
if (filters == null) {
filters = {};
}
filters["search"] = searchTerm;
final results = list(context, filters: filters);
return results;