Reputation: 706
I know I can configure ui-grid to show extra menu items on a per column basis, such as the following.
$scope.gridOptions = {
"data": "results.values",
"columnDefs": [
{ "name": "Employee Number",
"field": "emp_no",
"menuItems":[
{
"title":"Sort All Asc",
"action":function(){console.log('test')}
}
]
}
]
}
Is there any way I can do this not in the columnDefs property, so that an item will be applied to all columns?
Upvotes: 0
Views: 672
Reputation: 958
After you specify your gridOptions, you can do the following
for (var i = 0; i < $scope.gridOptions.columnDefs.length; i++) {
$scope.gridOptions.columnDefs[i].menuItems = yourMenuItemsArray;
}
Upvotes: 0