我使用Restangular來解析響應(產品列表)...我知道這個問題已經解決了。Kendo-UI Grid不通過AngularJS呈現數據
我是Kendo-UI的新手。但是已經建立了如下的基本測試網格。我正在使用k-rebind,因爲產品陣列在創建網格時可能未解決。
<kendo-grid k-options="mainGridOptions" k-rebind="products"></kendo-grid>
在我的控制器:
$scope.products = [];
$scope.therapyAreas = [];
$scope.dropDownTAs = [];
prProductService.getProducts().then(function(products) {
$scope.products = products;
prTAService.getTAs().then(function(tas) {
$scope.therapyAreas = tas;
for(var i = 0; i < $scope.therapyAreas.length;i++) {
$scope.dropDownTAs.push({id: $scope.therapyAreas[i].id, therapyArea: $scope.therapyAreas[i].therapyArea});
}
});
});
$scope.mainGridOptions = {
dataSource: {
data: $scope.products
},
height: 550,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
columns: [
"productName",
"activeIngredients",
"productComments",
"gpt",
"ta"
]
};
}])
我知道正在返回數組的產品,我還以爲K-重新綁定會看產品陣列更改,所以當它解決它刷新UI ...沒有這樣的運氣。
我已經嘗試在數據源中手動排列數組以反映產品數組的響應,並且網格工作正常。
問候
我
您好,感謝......是不是從那個鏈接很明顯,你必須:
在相位控制器:
在HTML視圖代碼綁定到選項。它只是說,你需要綁定到範圍內的東西,你需要看......我做了什麼。會給這個去,欣賞的迴應.... – smackenzie 2014-10-08 18:27:20
不用擔心!如果這仍然行不通,請告訴我更長的時間/完整:) – carlbergenhem 2014-10-08 18:54:54
在angularJs世界中,雖然可以綁定到一個空數組,但它應該被自動監視和刷新,這個級別的數據綁定不會發生在Kendo UI中呢? – smackenzie 2014-10-09 13:51:27