willw
willw

Reputation: 1308

Disable 'live sorting' in UI-Grid

When UI-Grid's sorting is enabled, if the user edits a value in a sorted column, the row in question may move or disappear from view when he exits the cell, as it is sorted to a new position.

The documentation actually boasts about this as a feature: see http://ui-grid.info/docs/#!/tutorial/Tutorial:%20102%20Sorting "The sort is automatically recalculated when you edit a field (the edit feature calls the dataChange api to notify of a data change)". But in my use case it is not wanted, and can make editing data very hard.

Is it possible to set the grid so that it only sorts its rows when requested to do so, by user click on column headers, or API call?

Upvotes: 0

Views: 138

Answers (1)

Remko
Remko

Reputation: 359

You could write your own sorting routine (see: http://ui-grid.info/docs/#!/tutorial/Tutorial:%20307%20External%20Sorting). Ignore any rows that have been edited (use the original value for sorting in that case).

Another approach would be sorting your data in advance, and disabling UI-Grids sorting.

Upvotes: 1

Related Questions