0
我正在使用kendo ui網格,我想將列標題綁定到json文件,而不是直接在控制器中指定它。將kendo ui網格列標題綁定到AngularJs中的作用域
我創建了一個成功地檢索從JSON文件中的數組的函數,並填充範圍:
function returnColumns(){
$http.get('app/data/headers.json')
.then(function(res){
$scope.myHeaders = res.data;
});
}
returnColumns();
而且在網格的選項,我指的列在範圍變量:
$scope.options = {
dataSource: {
type: "json",
transport: {
read: "app/data/myData.json"
},
pageSize: 10,
schema : {
data: "mySchema"
}
},
sortable: true,
pageable: true,
resizable: true,
columns:$scope.myHeaders
....
....
但綁定不進來,頭不更新。
謝謝!
好極了!這個伎倆,非常感謝你。 – Gart