Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
Add child to hierarchical grid
posted

Hi, 

I'm trying to add a new row to a child component (IgxRowIsland) of a hierarchical grid (IgxHierarchicalGrid), but am not able to succeed. 

According to the documentation, there is a method that can be used to add a new row to the RowIsland like below:

const record = {
    ID: this.grid1.data[this.grid1.data.length - 1].ID + 1,
    Name: this.newRecord
};
this.grid1.addRow(record);

However, during executing I'm getting the error that the data object is undefined, and that you cannot read length from the property undefined. 

What am I doing wrong or is there a workaround? 

See the example on stackblitz with the exact code I'm using: https://stackblitz.com/edit/addrowhierarchicalgrid

Thanks!