search users in list search by full name
This commit is contained in:
parent
79aaa949ae
commit
49aea04b9b
@ -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