I have some problems loading the state of the grid in Angular.
This is the grids HTML:
Later I start my Http call and the $scope.GridOptions are filled and the grid works fine.
Then I save the state of my grid this way:
This works fine when i print the output in the console. It looks like this:
When i try to reload the grid with the saved state, i read the JSON, parse it and reassign it to $scope.GridOptions. But this don't work:
Why is the grid not updated after this line of code?
I really appreciate any help you can provide!
This is the grids HTML:
<
div
id
=
"grid"
kendo-grid
k-options
=
"GridOptions"
k-ng-delay
=
"GridOptions"
></
div
>
Later I start my Http call and the $scope.GridOptions are filled and the grid works fine.
Then I save the state of my grid this way:
$scope.GridOptionsBackup = kendo.stringify($scope.GridOptions);
This works fine when i print the output in the console. It looks like this:
{"dataSource":{"schema":{"data":"Data"},"transport":{},"serverSorting":true,"table":null,"fields":[{"encoded":true,"field":"WidgetName","title":"Name","template":"<
span
ng-bind
=
'dataItem.WidgetName'
>#: data.WidgetName#</
span
>"},{"encoded":true,"field":"WidgetDescription","title":"Description","template":"<
span
ng-bind
=
'dataItem.WidgetDescription'
>#: data.WidgetDescription#</
span
>"}]},"columns":[{"field":"WidgetName","title":"Name","template":"<
span
ng-bind
=
'dataItem.WidgetName'
>#: data.WidgetName#</
span
>"},{"field":"WidgetDescription","title":"Description","template":"<
span
ng-bind
=
'dataItem.WidgetDescription'
>#: data.WidgetDescription#</
span
>"}],"sortable":{"mode":"multiple","allowUnsort":true},"scrollable":true}
When i try to reload the grid with the saved state, i read the JSON, parse it and reassign it to $scope.GridOptions. But this don't work:
$scope.GridOptions = JSON.parse($scope.GridOptionsBackup);
Why is the grid not updated after this line of code?
I really appreciate any help you can provide!