Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting on multiple values #160

Closed
hazeledmands opened this issue Dec 28, 2013 · 4 comments
Closed

Sorting on multiple values #160

hazeledmands opened this issue Dec 28, 2013 · 4 comments

Comments

@hazeledmands
Copy link
Contributor

First I just want to say I absolutely love this project. It's so convenient. Thanks for all the awesome work!

Here's a question. I'm trying to sort a column that's based on multiple values. Here's an example, where I want to be able to sort by two dates with one click:

var data = [
  { name: 'lincoln',    birth: 1809, death: 1865 },
  { name: 'fdr',        birth: 1882, death: 1945 },
  { name: 'washington', birth: 1732, death: 1799 },
  { name: 'jfk',        birth: 1917, death: 1963 },
  { name: 'darwin',     birth: 1809, death: 1882 },
  { name: 'poe',        birth: 1809, death: 1849 }
];

$scope.table = new ngTableParams({sorting: {name: 'asc'}}, {
  total: data.length,
  getData: function($defer, params) {
    $defer.resolve($filter('orderBy')(data, params.orderBy()));
}});
<table ng-table='table'>
  <tr ng-repeat='row in $data'>
    <td data-title='Name' sortable="'name'">{{row.name}}</td>
    <td data-title='Lifespan' sortable="['birth', 'death']">{{row.birth}} - {{row.death}}</td>
  </tr>
</table>

sortable="['birth', 'death']" doesn't actually work in this case. I could just set sortable to 'birth', but then individuals born on the same day would be in an indeterminate order. Is there some way of achieving this that I am missing? Is it something that I could open a pull request for?

Thanks!
~Max

hazeledmands pushed a commit to hazeledmands/ng-table that referenced this issue Dec 28, 2013
@vuongdothanhhuy
Copy link

I would like to ask for multi-col sort support also...

@damon-kreft
Copy link

👍 for multi-column sort

@Nate-Wilkins
Copy link

I thought this was by default but couldn't get it working looks like the functionality isn't really there.:+1:

@furyscript
Copy link

Please +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants