PrimeNG TreeTable cannot get Row index

Discussão em 'Angular' iniciado por Markiza, Junho 17, 2025.

  1. Markiza

    Markiza Guest

    Trying to use rowIndex inside TreeTable. With DataTable rowIndex works fine, but with TreeTable rowIndex is undefined.

    <p-treeTable [value]="files1">
    <p-header>Basic</p-header>
    <p-column header="ID">
    <ng-template let-rowIndexValue="rowIndex" pTemplate="body">
    <p class="rw-center-align">{{rowIndexValue}}</p>
    </ng-template>
    </p-column>
    <p-column field="name" header="Name"></p-column>
    <p-column field="size" header="Size"></p-column>
    <p-column field="type" header="Type"></p-column>
    <p-column header="Actions">
    <ng-template let-rowIndexValue="rowIndex" pTemplate="body">
    <button pButton label="Add child" (click)="addChild(rowIndex)"></button>
    </ng-template>
    </p-column>
    </p-treeTable>


    Here in addChild() method I'm getting rowIndexValue as undefined, and ID column is empty.

    Continue reading...

Compartilhe esta Página