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
65
igx tree grid row index undefined after upgrade to igniteui angular 12.2.3
posted

Upgrade from igniteui 8 to igniteui 12.2.3.

After that getting below error for igx tree grid:

 <igx-tree-grid  #treeGrid [data]="Data" [autoGenerate]="false" emptyGridMessage="Loading....." [isLoading]="isLoading"   [allowFiltering]="false"
            primaryKey="Id" foreignKey="parentId">  
   <igx-column field="approve" header=" " [width]="'120px'"  >        
              <ng-template igxCell let-cell="cell" >
                  <button title="approve igxButton="raised"   [disabled]="cell.value"  *ngIf = "cell.row.rowData.parentId === -1" (click)="Approve(cell.cellID.rowIndex)" >
                     Approve
                  </button>
       
          </igx-column>
 </igx-tree-grid>
approve.ts file:
 public Approve(rowIndex) {
    this.isLoading = true;
}
Error:
core.js:6498 ERROR TypeError: Cannot read properties of undefined (reading 'rowIndex')
  • 1700
    Offline posted

    Hello Siva,

    The reason why you are getting ‘undefined’ is that the accessors and properties have been changed from version 8 to version 12, in fact if you would like to access the row index of a certain cell it could be done with the following code:

     cell.row.idnex

    I also recommend you reviewing the API documentation for version 12, there you can review all the classes, interfaces, functions, enumerations etc.

    For example, the way you could check which properties and accessors to use while trying to find out how to access the row index of a certain cell using version 12 is by reviewing the IgxGridCell class as well as the IgxTreeGridRow

    Let me know if you need any further assistance.

    Regards,
    Ivan Kitanov