1

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.

4

1 回答 1

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

如果在控制器中更改了范围变量,则更改的值将不会反映在使用它的任何地方。必须保持一个手表并在里面做相应的逻辑。

对于您的问题,您无需密切关注。以下代码行应该可以解决问题。CodePen 在这里

$scope.changeColTitles = function(){
    $scope.options.columns[0].title = 'col ' + ++$scope.a;
    $scope.options.columns[1].title =  'col ' + ++$scope.b;
  }
于 2015-10-06T03:48:49.650 回答