Rick
Rick

Reputation: 91

Angular UI-Grid 3 - how to programatically sort?

The question says it all. I can set the column, on which to sort, in code:

cols[colIdx].sort = { direction: uiGridConstants.DESC, priority: 1 };

But it doesn't actually perform the sort, just puts a sort icon in the header. User has to actually click on the column header for the sort to occur. What additional code do I need to have the sort happen programmatically?

Been at this for hours, any thoughts would be greatly appreciated. Rick.

Upvotes: 2

Views: 3575

Answers (1)

squistbe
squistbe

Reputation: 305

From the gridApi you can call gridApi.grid.sortColumn(column).

Upvotes: 2

Related Questions