angularjs - How do you update ng-grid gridOptions.sortInfo? -


i trying programmatically update gridoptions.sortinfo on angular grid ng-grid, can't working.

i have both "name" , "age" columns. setting sort on "name" column load new data , update sort on "age". (programmatically, not clicking column header).

i can set $scope.gridoptions.sortinfo new value, grid not reflect this. correct way update gridoptions.sortinfo ?

please see plunker:

http://plnkr.co/edit/jbynrwlaiwfsks6usand?p=preview

edit: please note able update sort direction i.e. ascending/descending actual column sort on.

many thanks

yes, according source code (line number 128 here link) should able this:

$scope.updatesortinfo = function() {   $scope.gridoptions.sortby('name'); } 

the plunker shows works. forked here.

here's version sortcolumn passed in text box: plunker.


Comments