我正在开发一个混合应用程序我有一个具有这种结构的数组
controller.js
function getReference(fam, souFam, db, trans, $q) {
var arr = [];
var deferred = $q.defer();
var query = null;
if (trans == "fr") {
query = "SELECT Reference + '_' + CAST(Durete AS TEXT) AS Reference, Charge, Fleche, Caoutchouc, Coerig, Epais, Durete, Flechemax FROM SUSPENSIONS WHERE Famille = ? AND Fixation = ? ORDER BY Charge";
} else {
query = "SELECT Reference + '_' + CAST(Durete AS TEXT) AS Reference, Charge, Fleche, Caoutchouc, Coerig, Epais, Durete, Flechemax FROM SUSPENSIONS WHERE Famille = ? AND Fixang = ? ORDER BY Charge";
}
db.executeSql(query, [fam, souFam], function(res) {
for (var i = 0; i < res.rows.length; i++) {
arr.push({
{
'Reference': res.rows.item(i).Reference,
'Nominal load (daN)': res.rows.item(i).Charge,
'Nominal static deflection (mm)': res.rows.item(i).Fleche
}
});
}
deferred.resolve(arr);
},
function(error) {
console.error(error.message);
console.log('SELECT error: ÷' + error.message);
},
function() {
console.log('transaction ok');
});
return deferred.promise;
}
$scope.gridOptions= getReference(par1, par5,par3,par4,par5);
HTML
<div ui-grid=" {data: gridOptions}" class="grid"> </div>
但是在我的ui-grid中只显示“参考”列数据,而其他列只显示标题。
仅