Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
AngularJS Updating DataSource


I'm trying to figure out how to refresh the grid after assigning new data to DataSource but can't seem to figure it out.

For example:

$scope.gridData = [{"ID": 1, "Name": "Davolio"},{"ID": 2, "Name": "Fuller"}];

$scope.gridOptions = {dataSource: $scope.gridData, primaryKey: "ID"};

And the grid displays everything correctly. But now I want to change the DataSource to something completely different.

Attempt 1, assigning new data to $scope.gridData:

$scope.gridData = [{"Color": 'Blue', "Number": 9},{"Color": 'White', "Number": 7}];

Attemp 2, change DataSource using grid's API:

$("#grid1").igGrid("option", "dataSource", [{"Color": 'Blue', "Number": 9},{"Color": 'White', "Number": 7}]);

None of those methods update the grid to show it's new dataSource. Any help? Thanks.