I created an table, everything is fine but the problem is I can't sort the data (asc or desc), do I have to create some other code in typeScript or what exactly should I do ?
<ngx-datatable
#table
[rowHeight]="'auto'"
[headerHeight]="'auto'"
[footerHeight]="40"
[externalSorting]="true"
[externalPaging]="true"
[rows]="data"
[count]="totalElements"
[offset]="pageNum"
[limit]="size"
(page)="upPage($event)"
columnMode="force">
<ngx-datatable-column
[name]="userDataTable.lastname" prop="lastName" cellClass="font-weight-bold">
<ng-template let-user="row" ngx-datatable-cell-template>
<p>{{ user.lastName }}</p>
</ng-template>
</ngx-datatable-column>
...
</ngx-datatable>
You declared a column with ngx-datatable-cell-template
and it's maybe disabling the sorting.
First make sure that sorting is enabled by setting the column option sortable
to true
(but I think this is the default value ...).
You can in all cases affect a custom sorting function to any column thanks to the column options (with comparator
attribute).
Check the ngx-datatable example source code here .
Hope that will help you !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.