<eg-translate #translator></eg-translate>
<eg-grid #grid idlClass="{{idlClass}}" [dataSource]="dataSource"
+ (onRowActivate)="onGridRowActivate($event)"
[sortable]="true" persistKey="{{persistKey}}">
<eg-grid-toolbar-button [disabled]="!canCreate"
label="New {{idlClassDef.label}}" i18n-label [action]="createNew">
this.initDataSource();
}
- // TODO: pass the row activate handler via the grid markup
- this.grid.onRowActivate.subscribe(
- (idlThing: IdlObject) => {
- this.editDialog.mode = 'update';
- this.editDialog.recId = idlThing[this.pkeyField]();
- this.editDialog.open({size: this.dialogSize}).then(
- ok => {
- this.successString.current()
- .then(str => this.toast.success(str));
- this.grid.reload();
- },
- err => {}
- );
- }
- );
-
this.createNew = () => {
this.editDialog.mode = 'create';
this.editDialog.open({size: this.dialogSize}).then(
return this.contextOrg && this.contextOrg.children().length === 0;
}
+ onGridRowActivate(idlThing: IdlObject) {
+ this.editDialog.mode = 'update';
+ this.editDialog.recId = idlThing[this.pkeyField]();
+ this.editDialog.open({size: this.dialogSize}).then(
+ ok => {
+ this.successString.current()
+ .then(str => this.toast.success(str));
+ this.grid.reload();
+ },
+ err => {}
+ );
+ }
}