ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Is there any good way to refresh data changes manually?

Open junkoro opened this issue 12 years ago • 2 comments

I just wanna do something like this.

https://github.com/angular-ui/ng-grid/blob/2.0.8/build/ng-grid.js line:2930-

grid.applyDataChanges = function() {
  dataWatcher($scope.$eval(options.data));
  $scope.adjustScrollTop(grid.$viewport.scrollTop(), true);
};
// not needed ?
//$scope.$on('$destroy', $scope.$parent.$watch(options.data, dataWatcher));
$scope.$on('$destroy', $scope.$parent.$watch(options.data + '.length', grid.applyDataChanges));

Is there any function that I don't know?

junkoro avatar Jun 12 '14 05:06 junkoro

I'm not sure what you're asking for. I can tell you that ng-grid will automatically update if your data changes if you declare your data object as a string referencing the name of your data object on your $scope. As mentioned in the getting started section here: http://angular-ui.github.io/ng-grid/ , the following would work:

$scope.myData = [{name: "Moroni", age: 50},
                 {name: "Tiancum", age: 43},
                 {name: "Jacob", age: 27},
                 {name: "Nephi", age: 29},
                 {name: "Enos", age: 34}];
$scope.gridOptions = { data: 'myData' };

If at any point afterwords you changed the $scope.myData array, the grid would update accordingly.

linkmastr001 avatar Jun 13 '14 19:06 linkmastr001

This looks to have a reasonable resolution on it, and no action for some time. Closing.

PaulL1 avatar Sep 07 '14 08:09 PaulL1