javascriptangularjskendo-uiangular-kendo

Angular Kendo Grid with k-rebind not deep watching it's options object


I have an Angular Kendo Grid referencing it's options object with k-options and k-rebind...

<kendo-grid k-data-source="data" k-options="options" k-rebind="options"></kendo-grid>

When I change the column titles in the referenced options object the grid doesn't notice the change and therefore doesn't fire k-rebind on the next digest.

How can I get it to watch the options object deeply and notice these important changes?

Working code pen.


Solution

  •  $scope.changeColTitles = function(){
        $scope.a++;
        $scope.b++;
      }
    

    If a scope variable is changed in a controller, the changed value won't be get reflected where ever it is used. A watch must be kept and do the corresponding logic inside.

    And for your problem, you don't need to keep either watch. The following line of code should resolve the problem. CodePen is here.

    $scope.changeColTitles = function(){
        $scope.options.columns[0].title = 'col ' + ++$scope.a;
        $scope.options.columns[1].title =  'col ' + ++$scope.b;
      }