[ADF-4893] Fix visibility condition in datatable action menu (#5088)

* [ADF-4893] Fix visibility condition in datatable action menu

* Add filtering for when menu cache is disabled

* Fix unit test and improve code

* Fix linting

* Fix linting

* Add missing return type
This commit is contained in:
davidcanonieto
2019-10-14 15:28:24 +01:00
committed by Eugenio Romano
parent 1d7ef62095
commit 47ec01555a
3 changed files with 42 additions and 24 deletions

View File

@@ -568,12 +568,16 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
const event = new DataCellEvent(row, col, []);
this.showRowActionsMenu.emit(event);
if (!this.rowMenuCacheEnabled) {
return event.value.actions;
return this.getVisibleActions(event.value.actions);
}
this.rowMenuCache[id] = event.value.actions;
}
return this.rowMenuCache[id];
return this.getVisibleActions(this.rowMenuCache[id]);
}
getVisibleActions(actions: any[]): any[] {
return actions.filter((action) => action.visible || action.visible === undefined);
}
onExecuteRowAction(row: DataRow, action: any) {