Merge pull request #4295 from MaximilianKrambach/userSearchFix
search users in list search by full name
This commit is contained in:
commit
4d9adc291c
@ -112,6 +112,7 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser> implement
|
||||
this.dataSource.data = sortedData;
|
||||
this.checkSelection();
|
||||
});
|
||||
this.setFulltextFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -305,4 +306,18 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser> implement
|
||||
viewUser.user.is_present = !viewUser.user.is_present;
|
||||
await this.repo.update(viewUser.user, viewUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the dataSource's string filter with a case-insensitive search
|
||||
* in the full_name property
|
||||
*/
|
||||
private setFulltextFilter(): void {
|
||||
this.dataSource.filterPredicate = (data, filter) => {
|
||||
if (!data || !data.full_name) {
|
||||
return false;
|
||||
}
|
||||
filter = filter ? filter.toLowerCase() : '';
|
||||
return data.full_name.toLowerCase().indexOf(filter) >= 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user