josebalius / ngReactGrid

A really fast Angular grid using the power of React to render. Based on ng-grid and jQuery DataTables.
http://josebalius.github.io/ngReactGrid/
MIT License
328 stars 47 forks source link

Add a way to override the default sort #32

Open pmq opened 9 years ago

pmq commented 9 years ago

Hi Jose,

First of all, thanks for ngReactGrid, it works well. We needed a way to be able to specify our custom sort on some columns, hence this first draft. Before we go further on this (the current PR is crude), just wanted to know your opinion on this feature. Would there be enough interest to warrant merging at some point?

Thanks.

josebalius commented 9 years ago

@pmq sounds interesting, definitely interested in merging this functionality.

josebalius commented 9 years ago

@pmq is this complete? or still waiting to submit more?

pmq commented 9 years ago

@josebalius I'm waiting to push this into production for us, and see if the users complain :) It should only be a few days.

Two questions though, to adapt the PR :

  1. right now I've put the sort function in sortInfo, maybe this should go top-level, just like ngGrid used to do with sortFn?
  2. in your original object comparison code, you have two possible return values (1 and -1), but not 0 to denote equality; should I do the same (right now I return 0 in case the two objects are equal)?
pmq commented 9 years ago

@josebalius I didn't forget this PR - right now we're running this and it seems OK. The two questions still stand, but if you want to review as-is, it's also fine for me. Let me know!