The === null test for determining if a disableOnRows handler was set was
not broad enough to capture undefined values. This commit changes it to
a more generic if() test to cover null/undefined. Also, instead of
creating a dummy function in the action, the testing code checks for the
presence of the function at run time.
Apply a fix to an ng-lint warning introduced by this series of commits in
the sandbox code.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
const action = new GridToolbarAction();
action.label = this.label;
action.action = this.action;
-
- action.disableOnRows = (this.disableOnRows === null) ?
- (rows: any[]) => false : this.disableOnRows;
+ action.disableOnRows = this.disableOnRows;
this.grid.context.toolbarActions.push(action);
}
}
shouldDisableAction(action: GridToolbarAction) {
- return action.disableOnRows(this.gridContext.getSelectedRows());
+ if (action.disableOnRows) {
+ return action.disableOnRows(this.gridContext.getSelectedRows());
+ }
+ return false;
}
printHtml() {
};
this.complimentEvergreen = (rows: IdlObject[]) => alert('Evergreen is great!');
- this.notOneSelectedRow = (rows: IdlObject[]) => (rows.length != 1);
+ this.notOneSelectedRow = (rows: IdlObject[]) => (rows.length !== 1);
}