Gold100 Gold100 - 4 months ago 120x
AngularJS Question

How to Save Selection in Angularjs UI - Grid

I built this

that updates every 3 seconds:

function updateGrid() {
dFactory.getData().then(function(data) {
$ = data;

The data updates just fine, but the selection deletes itself, the rows I select before just won't save.

I have tried:

  1. Putting primary key - didn't help

  2. Saving state and restore it after update - didn't help

  3. Manually select rows after update - didn't help

What can i do?


This is how i solved it:

var state = $;
                $scope.mydata =;

                $timeout(function() {
                    $scope.gridApi.saveState.restore($scope, state);
                }, 1);