-3
angularjs中的uigrid不加載數組對象。當我將選擇查詢更改爲存儲過程時,會發生此錯誤。angularjs uigrid不加載數組
繼承人使用存儲過程返回結果 enter image description here 此數組結果不顯示數據。
heres返回的結果使用顯示數據的select查詢。如何將數組數據更改爲對象? enter image description here
angularjs中的uigrid不加載數組對象。當我將選擇查詢更改爲存儲過程時,會發生此錯誤。angularjs uigrid不加載數組
繼承人使用存儲過程返回結果 enter image description here 此數組結果不顯示數據。
heres返回的結果使用顯示數據的select查詢。如何將數組數據更改爲對象? enter image description here
我發現我自己的一個解決方案.. 這裏是在服務器端控制代碼...
con.query("CALL `sp_tviselect`", function(err, result) {
if(err){
throw err;
} else {
//console.log(result);
res.send(JSON.stringify(result));
}
});
這裏是在客戶端控制器上的代碼
$http.get('/api/tvi/list')
.success(function(data) {
var newObj = {};
for(i=0; i<data.length; i++)
{
newObj[i]=data[i];
}
$scope.gridOptions.data = newObj[0];
newObj[0].forEach(function addRows(row, index){
row.businesstype = row.businesstype==='DTI' ? '1' : '2';
});
});
首先我將原始數據口袋轉換成json字符串格式。然後在客戶端,我得到索引爲0的數組的列表元素,然後將其放到對象變量中。
我希望這會幫助其他人。謝謝