-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的数组的列表元素,然后将其放到对象变量中。
我希望这会帮助其他人。谢谢