2016-01-07 101 views
2

測試按鈕更改模型數據,單元格數據更改,但不更改樣式。激活更改的單元格並單擊更新,觸發樣式更改。我嘗試調用core.refresh()。但不起作用。修改模態數據後,UI-Grid不會刷新動態樣式

$scope.changeData = function() { 
    $scope.gridOptions.data[1].company = "Velity"; 
} 

http://plnkr.co/edit/A9Vpxs6OgIfkaLT3Gg2y?p=preview

+0

這似乎是cellClass函數被調用只有當電網進行重新渲染。如果你滾動它,那麼該行得到正確的顏色。 – imbalind

回答

0

對我喊gridApi.core.notifyDataChange後更改數據的工作。

控制器中的一個例子:

module.controller('myController', function ($scope, uiGridConstants, ...other deps) { 
    $scope.gridOptions= { 

     //...blah blah, 

     onRegisterApi: function(gridApi) { 
      $scope.gridApi = gridApi; 
     } 
    }; 

    //... 

    $scope.something = function() { 
     $scope.gridOptions.data[1].something = 'Something'; 
     $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.EDIT); 
    } 
}