0
votes

I haved tried angular table sorting on nested ng-repeat object of array using orderby filter.But table sorting is not working properly. I made an example in plunker. How to use orderby filter on inner ng-repeat iteration? Anything I missed out here? My table columns 'name' and 'value' is not sorted anything?

<div ng-repeat="(key,keydatas) in datas">
<div ng-repeat="datas in keydatas | filter: orderBy:orderByField:sortOrder">
          <span >{{datas.name}}</span>
          <span >{{datas.value}}</span>
    </div>

How to give the 'orderByfield' here? $scope.orderbyField='value'; is not sorting by the value?

plunker here

1
But If I click on particular table column sorting It will reflect the other table also all the tables are sorted. Anywat to fix this? - VijayVishnu

1 Answers

0
votes

Syntax is incorrect

Change

| filter: orderBy:orderByField:sortOrder

To

| orderBy:orderByField:sortOrder

Note that since values are strings you would need to use custom filter to cast as number and sort