【问题标题】:PrimeNG TreeTable cannot get Row indexPrimeNG TreeTable 无法获取行索引
【发布时间】:2017-11-02 07:23:42
【问题描述】:

尝试在TreeTable 中使用rowIndexDataTable 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() 方法中,我得到rowIndexValueundefined,而ID 列是空的。

【问题讨论】:

    标签: angular primeng


    【解决方案1】:

    来自文档:

    DataTable 存在 rowIndex,但TreeTable 不存在

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-03
      • 2019-06-12
      • 1970-01-01
      • 2021-01-02
      • 1970-01-01
      • 2019-03-30
      • 2018-12-28
      相关资源
      最近更新 更多