Skip to content

Commit

Permalink
fix(hgrid): Expose onGridInitialized output #6860
Browse files Browse the repository at this point in the history
  • Loading branch information
dkamburov committed Jun 4, 2020
1 parent f07dcc3 commit f0a64c5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes for each version of this project will be documented in this
## 9.1.0

### General
- `IgxHierarchicalGrid`
- `onGridInitialized` - New output has been exposed. Emitted after a grid is being initialized for the corresponding row island.
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
- **Behavioral Change** - When a column is sortable sort indicator is always visible. The column is sorted when click on it.
- `igx-paginator` - The following inputs have been deprecated for the `paginator` component and will be removed in future versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Below is the list of all inputs that the developers may set to configure the gri
|--- |--- |
|_Event emitters_|_Notify for a change_|
| onGridCreated | Emitted when a grid is being created for this row island | false | parentRecord: `any`, owner: `IgxRowIslandComponent`, grid: `IgxHierarchicalGridComponent` |
| onGridInitialized | Emitted after a grid is being initialized for this row island. The emitting is done in `ngAfterViewInit` | false | parentRecord: `any`, owner: `IgxRowIslandComponent`, grid: `IgxHierarchicalGridComponent` |


### Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ private resolver;
this.hGrid.childRow = this;
// handler logic that re-emits hgrid events on the row island
this.setupEventEmitters();
this.hGrid.rootGrid.cdr.detectChanges();
this.layout.onGridCreated.emit({
owner: this.layout,
parentID: this.rowData.rowID,
Expand All @@ -161,6 +160,12 @@ private resolver;
this.parentGrid.hgridAPI.registerChildGrid(this.rowData.rowID, this.layout.key, this.hGrid);
this.layout.rowIslandAPI.registerChildGrid(this.rowData.rowID, this.hGrid);

this.layout.onGridInitialized.emit({
owner: this.layout,
parentID: this.rowData.rowID,
grid: this.hGrid
});

this.hGrid.cdr.detectChanges();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
// enable sorting
const childGrid = hierarchicalGrid.hgridAPI.getChildGrids(false)[0];
childGrid.columnList.first.sortable = true;
childGrid.cdr.detectChanges();
fixture.detectChanges();

const childHeader = GridFunctions.getColumnHeader('ID', fixture, childGrid);
GridFunctions.clickHeaderSortIcon(childHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1372,8 +1372,10 @@ export class IgxHGridRemoteOnDemandComponent {
}

gridCreated(event: IGridCreatedEventArgs, rowIsland: IgxRowIslandComponent) {
event.grid.data = this.generateRowIslandData(5);
event.grid.cdr.detectChanges();
setTimeout(() => {
event.grid.data = this.generateRowIslandData(5);
event.grid.cdr.detectChanges();
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ export class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective
@Output()
public onGridCreated = new EventEmitter<IGridCreatedEventArgs>();

/**
* Event emmited after a grid is created based on this row island.
* ```html
* <igx-hierarchical-grid [data]="Data" [autoGenerate]="true">
* <igx-row-island [key]="'childData'" (afterGridCreated)="gridCreated($event)" #rowIsland>
* <!-- ... -->
* </igx-row-island>
* </igx-hierarchical-grid>
* ```
* @memberof IgxRowIslandComponent
*/
@Output()
public onGridInitialized = new EventEmitter<IGridCreatedEventArgs>();

/**
* @hidden
*/
Expand Down

0 comments on commit f0a64c5

Please sign in to comment.