Reputation: 518
I am using ngTable to show data in table with pagination. But Now I want to add sorting on each column.
Does any on have an idea about it?
Upvotes: 1
Views: 727
Reputation: 832
have a look at ngTable documentation - here and example here
function demoController(NgTableParams, simpleList) {
this.tableParams = new NgTableParams({
// initial sort order
sorting: { name: "asc" }
}, {
dataset: simpleList
});
}
Upvotes: 3
Reputation: 884
Prefer this Example
<table ng-table="vm.tableParams" class="table" show-filter="true">
<tr ng-repeat="user in $data">
<td title="'Name'" filter="{ name: 'text'}" sortable="'name'">
{{user.name}}</td>
<td title="'Age'" filter="{ age: 'number'}" sortable="'age'">
{{user.age}}</td>
</tr>
</table>
you have to create filter like this.
Likewise you can add serch object name into each column
Upvotes: 0