Gold100 Gold100 - 2 years ago 597
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?

Answer Source

This is how i solved it:

var state = $;
                $scope.mydata =;

                $timeout(function() {
                    $scope.gridApi.saveState.restore($scope, state);
                }, 1);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download