[英]Angular 4 and ngx-datatable: 'ngx-datatable' is not a known element
[英]ngx-DataTable sort on a column not working Angular 4
虽然我对角度非常新,但我在使用ngx-DataTable时遇到了一些困难。 我使用简单的ngx-DataTable进行简单的操作。 问题出在一个列上,虽然我已经将attr声明为[sortable] = true,但排序不起作用。 这是代码。 表定义:
<ngx-datatable
[columns]="columns"
[columnMode]="'force'"
[headerHeight]="40"
[footerHeight]="50"
[rowHeight]="'auto'"
[limit]="10"
[rows]='contacts'>
DataTable包含两列,定义如下。
<ngx-datatable-column
[width]="50"
[resizeable]="true"
[sortable]="true"
[draggable]="true"
[canAutoResize]="true" name="Name">
<ng-template let-row="row" ngx-datatable-cell-template>
<span>{{row.first_name}}</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
[width]="50"
[resizeable]="true"
[sortable]="true"
[draggable]="true"
[canAutoResize]="true" name="Actions">
<ng-template let-row="row" let-rowIndex="rowIndex" ngx-datatable-cell-template>
<!--Template Here-->
</ng-template>
</ngx-datatable-column>
我只是想让我的名字列可以排序。 请帮帮我们。 提前致谢。
好吧,它解决了。 实际上它无法找到可以进行列排序的值。 所以我只是在ngx-datatable-column
声明中写了prop='first_name'
,让它知道要排序的内容,就像这样。
<ngx-datatable-column
[width]="50"
[resizeable]="true"
[sortable]="true"
[draggable]="true"
[canAutoResize]="true" name="Name" prop="first_name">
</ngx-datatable-column>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.