{
"grossValue": 500,
"items": [
{
"billNo": "3",
"name": "coke",
"id": 556,
"billAmount": 150,
"quantity": 1,
"ingredientType": {
"isNonVeg": false,
"isAlcoholic": false,
"isBeverage": false
}
},
{
"billNo": "4",
"name": "hot dogs",
"id": 586,
"billAmount": 247,
"quantity": 1,
"ingredientType": {
"isNonVeg": false,
"isAlcoholic": false,
"isBeverage": false
}
}
]
}
我有JSON
来自请求URL
的数据库
我想在最后一个显示ingredientType的列中显示一个列
如果在最后一列的单元格中所有Boolean
值都为false,则显示“veg”。
问题是我无法将函数的值绑定到columnDefs
数组中的特定列的单元格,
columnDefs: [
{field: 'billNo'},
{field: 'name'},
{field: 'id'},
{field: 'billAmount'},
{field: 'quantity'},
{field: 'ingredientType'}
]
答案 0 :(得分:0)
我认为这就是你想要的。此基本示例将该行记录到控制台输出。
$scope.myFunction = function(rowEntity) {
console.log('$scope.myFunction called', rowEntity);
}
var actionTemplate = '<button ng-click="grid.appScope.myFunction(row.entity)">MyFunction</button>';
columnDefs: [
{field: 'billNo'},
{field: 'name'},
{field: 'id'},
{field: 'billAmount'},
{field: 'quantity'},
{field: 'ingredientType'},
{
field: 'actions',
displayName: 'Actions',
cellTemplate: actionTemplate
}
]