angular datatables会抛出错误

时间:2017-11-13 21:10:39

标签: angular datatables

我使用角度数据表以表格格式显示数据。该表在一个组件中呈现,该组件在父级中呈现为

<app-displaytable ></app-displaytable>

<data-table id="info-grid" headerTitle="" [items]="items" [itemCount]="itemCount" >
<data-table-column [property]="'a'" [header]="'Line Number'" [sortable]="true" [resizable]="true">
</data-table-column>
<data-table-column [property]="'b'" [header]="'Error Type'" [sortable]="true" [resizable]="true">
</data-table-column>
<data-table-column [property]="'c'" [header]="'Field'" [sortable]="true" [resizable]="true"> 
</data-table-column>
<data-table-column [property]="'d'" [header]="'Value'" [sortable]="true" [resizable]="true">
</data-table-column> 
<data-table-column [property]="'e'" [header]="'Description'" [sortable]="true" [resizable]="true">/data-table-column></data-table>

我收到错误:

  

DataTable.html:36错误类型错误:无法读取属性&#39;长度&#39;的   未定义       在DataTable.get [as substituteItems](table.component.js:292)

我确信我在&#34; items&#34;之后渲染数据表。可用

代码:

<app-displaytable> </app-displaytable>

  <div class="panel-body"  style="padding-left: 0px; padding-right: 0px; padding-top: 0px; 
         padding-bottom: 0px; overflow-y:scroll; height:400px;" [hidden]="itemCount===0">
    <data-table id="info-grid"  headerTitle="" [items]="items" [itemCount]="itemCount"  >
        <data-table-column [property]="'linenum'" [header]="'Line Number'" [sortable]="true" [resizable]="true">
          </data-table-column>
        <data-table-column [property]="'errorType'" [header]="'Error Type'" [sortable]="true" [resizable]="true">
        </data-table-column>
       <data-table-column  [property]="'fieldName'" [header]="'Field'"  [sortable]="true" [resizable]="true">    
        </data-table-column>
        <data-table-column [property]="'fieldValue'" [header]="'Value'" [sortable]="true" [resizable]="true">
          </data-table-column> 
          <data-table-column [property]="'description'" [header]="'Description'" [sortable]="true" [resizable]="true">
            </data-table-column>         

      </data-table>
  </div>

0 个答案:

没有答案