ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

custom sorting - sortingAlgorithm docu vs code

Open jsun01 opened this issue 12 years ago • 4 comments

The sortingAlgorithm in docu does not conform to the present implementation. In docu there is example http://ui-grid.info/docs/#/tutorial/102_sorting columnDefs: [ { ... sort: { ... sortingAlgorithm: function(a, b) { ... } } }

After debugging the ng-grid code, present code accepts only this: columnDefs: [ { ... sort: { ... }, sortingAlgorithm: function(a, b) { ... } }

Either docu doesn't conform to the code, or vice versa. Also - the second plunkr example at http://ui-grid.info/docs/#/tutorial/102_sorting doesn't work (json data missing).

jsun01 avatar Oct 22 '14 11:10 jsun01

For reference, please see https://github.com/angular-ui/ng-grid/blob/b622a1c7fd9537ec3309d53deaef2cac60d96fff/src/js/core/services/rowSorter.js#L269

McShazy avatar Oct 23 '14 18:10 McShazy

In tutorial docu at http://ui-grid.info/docs/#/tutorial/102_sorting please see the second example - tab "app2.js" - sortingAlgorithm is placed incorrectly inside sort insted of 1 level up - so the tutorial example doesn't work. If the implementation is ok, then the tutorial should be fixed as described above - sortingAlgorithm should be 1 level up.

jsun01 avatar Oct 23 '14 18:10 jsun01

Please note also the last sentence in 1.st comment - ... the second plunkr (and also jsfiddle) example at http://ui-grid.info/docs/#/tutorial/102_sorting doesn't work (json data missing).

jsun01 avatar Oct 24 '14 19:10 jsun01

Yeah, I had a look at that. It has exactly the same code as the grid above. I think the problem is the logic that puts it into the plunker, which is changing the file name to match the name plunker needs. I'm still thinking on options to resolve that.

PaulL1 avatar Oct 24 '14 22:10 PaulL1