Merge pull request #4908 from GabrielInTheWorld/topicSearch

Adds the option to filter a list by function-values
This commit is contained in:
Sean 2019-08-13 12:03:51 +02:00 committed by GitHub
commit 7f600d4369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -331,7 +331,13 @@ export class ListViewTableComponent<V extends BaseViewModel, M extends BaseModel
// custom filter predicates
if (this.filterProps && this.filterProps.length) {
for (const prop of this.filterProps) {
const propertyAsString = '' + item[prop];
let propertyAsString = '';
// If the property is a function, call it.
if (typeof item[prop] === 'function') {
propertyAsString = '' + item[prop]();
} else {
propertyAsString = '' + item[prop];
}
if (!!propertyAsString) {
const foundProp =

View File

@ -105,7 +105,7 @@ export class AgendaListComponent extends BaseListViewComponent<ViewItem> impleme
/**
* Define extra filter properties
*/
public filterProps = ['itemNumber', 'comment'];
public filterProps = ['itemNumber', 'comment', 'getListTitle'];
/**
* The usual constructor for components
@ -191,7 +191,7 @@ export class AgendaListComponent extends BaseListViewComponent<ViewItem> impleme
if (this.isMultiSelect || !this.canManage) {
return;
}
const dialogRef = this.dialog.open(ItemInfoDialogComponent, infoDialogSettings);
const dialogRef = this.dialog.open(ItemInfoDialogComponent, { ...infoDialogSettings, data: item });
dialogRef.afterClosed().subscribe(result => {
if (result) {