Hello Randall,
addRow also triggers the data pipes that process and render the data. You can view the code in the repo:
https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/grids/grid-base.component.ts#L3738
Since the data pipe trigger is currently not publicly accessible if you want to manually trigger a change that would re-render the rows you can change the value of the data object (the whole array). For example:
public addRow() {
const newData = this.data.splice(0);
const targetIndex = 0;
newData.splice(targetIndex, 0, this.product);
this.data = newData;
}
Regarding the HierarchicalGrid questions.
Could you elaborate on what you mean by “does not like the way I specify primaryKey”? Does it throw an error? Does it not work in the way you expect it to? If so describe what does not work as you expect?
In general if “_id” is the name of a property in your component to which you want to bind to then you should bind it without the additional apostrophes – [primaryKey]="_id". This will ensure that the property value, specified in your component definition, is properly bound to the primary key input.
If instead “_id” is an actual value (the actual column field, which you want to set as primary key) then you should include the apostrophes – [primaryKey]=" '_id' ", or simply not use binding since you are setting a static string which does not change dynamically – primaryKey=”_id”.
Regarding the events. The events trigger on the actual child grid instances, not on the row islands, as each time a row is expanded a hierarchical grid instance is created and each has their own events.
For the latest version we’ve added additional feature that re-emits child grid events up to the related RowIsland with and additional parameter (owner) that hold reference the actual child grid from which the event originates.
You can view the related issue here: https://github.com/IgniteUI/igniteui-angular/issues/5611
For older versions you can use the onGridCreated event, which is specific to the RowIsland component, to get a reference to the child grid when they get created and subscribe to the desired events there.
For example:
<igx-row-island (onGridCreated)="gridCreated($event)” …
public gridCreated(event: IGridCreatedEventArgs) {
event.grid.onRowSelectionChange .subscribe(() => {});
}
Let me know if you have any additional questions or concerns.
Regards,
Maya Kirova