0
我想傳遞數據值ui-grid.I需要將$ scope.ll值傳遞給ui-grid.If我複製數據並分配$ scope.ll = [{} Id和stateum_totalcount運行良好。我需要傳遞$ scope.ll電網將數據值傳遞給ui-grid
我的數據陣列作爲
{
"ID": "3",
"stat_sum": {
"totcount": 3
},
"zip_stats": [
{
"zip": "560045",
"count": 1
},
{
"zip": "567657",
"count": 2
}
],
"qual_stats": [
{
"count": 1,
"qualification": "B.E."
},
{
"count": 2,
"qualification": "BE"
}
],
"prof_stats": [
{
"count": 1,
"profession": "Doctor"
},
{
"count": 2,
"profession": "Software Engineer"
}
],
"city_stats": [
{
"city": null,
"count": 2
},
{
"city": "Bangalore",
"count": 1
}
],
"state_stats": [
{
"count": 1,
"state": "Karnataka"
},
{
"count": 2,
"state": "Kerala"
}
],
"stats_info": [
{
"acount": 3,
"answer": "fgdfgd",
"question": "comment-about-me-"
},
{
"acount": 1,
"answer": "one",
"question": "radio-answer-"
},
{
"acount": 2,
"answer": "two",
"question": "radio-answer-"
},
{
"acount": 3,
"answer": "t-shirt",
"question": "select-any-dress-for-me-[]"
},
{
"acount": 3,
"answer": "no",
"question": "say-yes-or-no-"
},
{
"acount": 3,
"answer": "2015-09-25",
"question": "select-your-b.date-"
},
{
"acount": 3,
"answer": "24",
"question": "select-your-age-"
},
{
"acount": 3,
"answer": "2",
"question": "type-number-"
},
{
"acount": 3,
"answer": "false",
"question": "select-true-or-false-"
}
]
}
在控制器
$timeout(function() {
console.log($scope.ll); //works fine
$rootScope.showspinner = false;
$scope.gridOptionsComplex = {
enableFiltering: true,
showGridFooter: true,
showColumnFooter: true,
columnDefs: [
{name: 'ID', width: 100, enableCellEdit: false,},
{name: 'stat_sum.totcount', width: 100, enableCellEdit: false,},
{name: 'zip_stats.zip', width: 100, enableCellEdit: false,},
{name: 'zip_stats.count', width: 100, enableCellEdit: false,},
{name: 'qual_stats.qualification', width: 100, enableCellEdit: false,},
{name: 'qual_stats.count', width: 100, enableCellEdit: false,},
],
data:$scope.ll
};
$scope.$apply(function() {
$scope.aut = true;
});
}, 500, false);
你能解釋一下先生嗎? – user3386779
你能告訴我哪個部分? – SakthiSureshAnand
我怎麼能modidy columnDefs:[]我的數組值的先生以及如何使用data.result.ids.length – user3386779