Reputation: 1553
I would like to attach a listener in my code to the "Ungroup" menu item in the column menu in an ui-grid, in order to make additional processing. Is this possible and if it is, how can I achieve this behavior?
Upvotes: 0
Views: 442
Reputation: 6196
There are no events when you ungroup on the grid column. The ungroup is implemented as part of the "uiGridGroupingService", so you can decorate the method ungroupColumn in that service and do additional processing.
app.config(function($provide){
$provide.decorator('uiGridGroupingService', function ($delegate) {
var oriUngroupColumn = $delegate.ungroupColumn;
$delegate.ungroupColumn = function(grid, column)
{
oriUngroupColumn.apply($delegate, arguments);
console.log("Do your additional processing here");
}
return $delegate;
})
});
Adding this to your app will provide you the option to add the additional processing. Example plnkr here http://plnkr.co/edit/zug6NTRSW1PJNm4IDM9u?p=preview
Upvotes: 1