IgniteUI / igniteui-angular

Ignite UI for Angular is a complete library of Angular-native, Material-based Angular UI components with the fastest grids and charts, Pivot Grid, Dock Manager, Hierarchical Grid, and more.
https://www.infragistics.com/products/ignite-ui-angular
Other
569 stars 159 forks source link

Add row results in error #10438

Closed mddifilippo89 closed 2 years ago

mddifilippo89 commented 2 years ago

Description

Add row programmatically results in error eg. Error: Cannot read properties of undefined (reading 'beginAddRowByIndex') or beginAddRow

Steps to reproduce

  1. Run sample https://stackblitz.com/edit/github-trveio
  2. Click Add row button

Result

Error: Cannot read properties of undefined (reading 'beginAddRowByIndex')

Expected result

Row is added at the top, index 0

Note, it should be documented how to set cell values using this method.

ChronosSF commented 2 years ago

Hey @mddifilippo89 ,

Your ViewChild selector wasn't matching the id in the template and grid1 ended up being undefined. Try it like this: @ViewChild('gridRowEdit', { read: IgxGridComponent, static: true })

mddifilippo89 commented 2 years ago

Thanks!