primeng datatable - 无法读取undefined的属性'index'

时间:2017-12-28 07:48:27

标签: angular primeng angular5 primeng-datatable

我正在尝试使用具有以下属性的primeng dataTable: editable='true' rowGroupMode="rowspan

但似乎这两个属性无法一起工作。 尝试编辑表格分组单元格时,我收到此错误:

ERROR TypeError: Cannot read property 'index' of undefined
at Object.eval [as updateDirectives] (datatable.d.ts.TableBody.html:23)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14689)
at checkAndUpdateView (core.js:13836)
at callViewAction (core.js:14187)
at execEmbeddedViewsAction (core.js:14145)
at checkAndUpdateView (core.js:13837)
at callViewAction (core.js:14187)
at execEmbeddedViewsAction (core.js:14145)
at checkAndUpdateView (core.js:13837)
at callViewAction (core.js:14187)

我用角度4和角度5尝试过但没有成功。

这是我的HTML代码:

<p-dataTable #dt [value]="newData" [editable]="true" editMode="row" editingRow="true" [rows]="15" rowGroupMode="rowspan" sortField="resourceGroup">
            <ng-container *ngFor="let col of cols">
                <p-column [field]="col.field" [header]="col.header" [editable]="col.editable"></p-column>
            </ng-container>
</p-dataTable>

1 个答案:

答案 0 :(得分:0)

使用[editable] =&#34; true&#34;在桌子上和在列上 喜欢

<p-dataTable [value]="yourArray" [editable]="true">
 <p-column field="yourField" header="yourHeader" [editable]="true"></p-column>