ui-grid
ui-grid copied to clipboard
removeFromGridMenu TypeError
/**
* Init grid api
*/
scope.gridOptions.onRegisterApi = function (gridApi) {
scope.gridApi = gridApi;
//Remove "Clear All Filters" from GridMenu
scope.gridApi.core.removeFromGridMenu(gridApi.grid, 0);
};
I want to remove Clear All Filters from gridMenu. When I try to call removeFromGridMenu I get:
TypeError: scope.gridApi.core.removeFromGridMenu is not a function
How I can call this function ? What would be correct way when I try to remove 'Clear all Filters'?
I also tried to remove Clear all Filters from menuItems array but this array is regenerated each time gridMenu is opened.
I noticed that Clear All Filters option always has id="menuitem-0", if you want remove that option, you can do this in css:
#menuitem-0{
display: none;
}
You have to wrap it in a timeout or something. Looks like even if after the gridApi has loaded it still needs to wait for the other components.
http://ui-grid.info/docs/#/tutorial/121_grid_menu
// interval of zero just to allow the directive to have initialized
$interval( function() {
gridApi.core.addToGridMenu( gridApi.grid, [{ title: 'Dynamic item', order: 100}]);
}, 0, 1);