Adds the option to filter a list by function-values

- In `agenda-list.component` the user can search through the name of the topic.
This commit is contained in:
GabrielMeyer 2019-08-12 11:39:21 +02:00
parent ed99fc8c91
commit 6e059cf82e
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) {