mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:21:26 +02:00
SearchMixin: Limit number of JSON search results
This commit is contained in:
parent
149e2fec76
commit
059cbfff55
@ -1196,8 +1196,14 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
{
|
{
|
||||||
return option.label.toLowerCase().includes(lower_search) || option.value.includes(search)
|
return option.label.toLowerCase().includes(lower_search) || option.value.includes(search)
|
||||||
});
|
});
|
||||||
|
// Limit results
|
||||||
|
const totalCount = filtered.length;
|
||||||
|
if(filtered.length > Et2WidgetWithSearch.RESULT_LIMIT)
|
||||||
|
{
|
||||||
|
filtered.splice(Et2WidgetWithSearch.RESULT_LIMIT);
|
||||||
|
}
|
||||||
// Add the matches
|
// Add the matches
|
||||||
this.processRemoteResults(filtered);
|
this.processRemoteResults(filtered, totalCount);
|
||||||
return filtered;
|
return filtered;
|
||||||
})
|
})
|
||||||
.catch((_err) =>
|
.catch((_err) =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user