break;
case 'Enter':
if (this.context.lastSelectedIndex) {
- this.grid.onRowActivate$.emit(
+ this.grid.onRowActivate.emit(
this.context.getRowByIndex(
this.context.lastSelectedIndex)
);
this.context.selectOneRow(index);
}
- this.grid.onRowClick$.emit(row);
+ this.grid.onRowClick.emit(row);
}
onRowDblClick(row: any) {
- this.grid.onRowActivate$.emit(row);
+ this.grid.onRowActivate.emit(row);
}
}
-import {Component, Input, OnInit, AfterViewInit, EventEmitter, OnDestroy,
- HostListener, ViewEncapsulation} from '@angular/core';
+import {Component, Input, Output, OnInit, AfterViewInit, EventEmitter,
+ OnDestroy, HostListener, ViewEncapsulation} from '@angular/core';
import {Subscription} from 'rxjs/Subscription';
import {IdlService} from '@eg/core/idl.service';
import {OrgService} from '@eg/core/org.service';
// These events are emitted from our grid-body component.
// They are defined here for ease of access to the caller.
- onRowActivate$: EventEmitter<any>;
- onRowClick$: EventEmitter<any>;
+ @Output() onRowActivate: EventEmitter<any>;
+ @Output() onRowClick: EventEmitter<any>;
constructor(
private idl: IdlService,
) {
this.context =
new GridContext(this.idl, this.org, this.store, this.format);
- this.onRowActivate$ = new EventEmitter<any>();
- this.onRowClick$ = new EventEmitter<any>();
+ this.onRowActivate = new EventEmitter<any>();
+ this.onRowClick = new EventEmitter<any>();
}
ngOnInit() {
this.columnSet.isSortable = this.isSortable === true;
this.columnSet.isMultiSortable = this.isMultiSortable === true;
this.columnSet.defaultHiddenFields = this.defaultHiddenFields;
+ this.generateColumns();
}
// Load initial settings and data.
initData() {
-
- // run in timeout because we are modifying the state of the
- // grid column header component mid-digest
- setTimeout(() => this.generateColumns());
-
this.applyColumnsConfig()
.then(ok => this.dataSource.requestPage(this.pager))
.then(ok => this.listenToPager());
this.initDataSource();
}
- this.grid.onRowActivate$.subscribe(
+ // 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]();