2
我不知道如何做什麼應該是非常簡單的。角度用戶界面網格重新加載單元格模板
我在我的UI網格中有10列,它們都是可編輯的。我的目標是動態地「禁用」,或者讓它們成爲「必需的」輸入,具體取決於範圍對象的選項。
對象:
$scope.columnOptions = {
'column1': 'MANDATORY',
'column2': 'DISABLED'....
}
電池模板
cellTemplate: '<input ng-disabled="{{ grid.appScope.columnOptions.column1=== \'DISABLED\' }}" ' +
'ng-required="{{ grid.appScope.columnOptions.column1=== \'MANDATORY\' }}" ' +
'data-ng-model="row.entity.column1" style="width:95%">'
這個工程是否存在在初始化的對象。
問題是,當我更改columnOptions的值時,行不會更新。
我曾嘗試不同的UI網API來重裝我的模板,但它沒有工作:
$scope.gridApi.core.refresh();
$scope.gridApi.core.raise.reloadData();
$scope.gridApi.core.refreshRows();
$scope.gridApi.core.notifyDataChange('all');
我添加了一個plunker:
是的..非常感謝。 1問題,爲什麼最初起作用? –
我對UI Grid的內部工作知之甚少,但我會假設有一組不同的代碼會在初始綁定時觸發,而當您更改綁定到網格的變量時會觸發代碼。在你的情況下,所討論的變量是'grid.appScope.columnOptions'屬性。 – KreepN