【发布时间】:2017-11-02 07:23:42
【问题描述】:
尝试在TreeTable 中使用rowIndex。
DataTable rowIndex 工作正常,但 TreeTable rowIndex 未定义。
<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>
在addChild() 方法中,我得到rowIndexValue 为undefined,而ID 列是空的。
【问题讨论】: