Reputation: 36
I have enabled the grid menu using
gridOptions.enableGridMenu = true
I am getting the grid menu with an option to show/hide individual columns. I would like to customize the "columns" text that appears here. I am not using the i18 service of Angular as I have my own resources. How can I change that text?
Please refer to this
Also, can I hide the "Clear all filters" menu item?
Upvotes: 1
Views: 3217
Reputation: 21
Don't know if you already resolved your issue but, AFAIK there is no way to change the default text of the default menu items without using i18nService. Apart from suppressing all the defaults and adding your custom menu items that is.
You could try to override the default text using your customs like this How to change the default text of UI-Grid menu option.
Hope this helps!
Cheers!
Upvotes: 1
Reputation: 3324
I have tried it with removeFromGridMenu, but it fails because the grid.gridMenuScope.registeredMenuItems contains "Export all data as csv", "Export visible data as csv", etc. but not "Clear all filters". It appears that it is hard-coded to be added by getMenuItems.
Upvotes: 1
Reputation: 821
You can take help of this tutorial for Grid Menu Section http://ui-grid.info/docs/#/tutorial/121_grid_menu in the new UI grid
Check this function:
$interval( function() {
gridApi.core.addToGridMenu( gridApi.grid, [{ title: 'Dynamic item', order: 100}]);
gridApi.core.addToGridMenu( gridApi.grid, [{ title: 'New item', order: 600}]); }, 0, 1);
.....
gridApi.core.addToGridMenu( gridApi.grid, [{ title: 'New item', order: 600}]); }, 0, 1);
addToGridMenu(grid, items)
add items to the grid menu. Used by features to add their menu items if they are enabled, can also be used by end users to add menu items. This method has the advantage of allowing remove again, which can simplify management of which items are included in the menu when. (Noting that in most cases the shown and active functions provide a better way to handle visibility of menu items)
Parameters
Param Type Details
grid
Grid
the grid on which we are acting
items
array
menu items in the format as described in the tutorial, with the added note that if you want to use remove you must also specify an id field, which is provided when you want to remove an item. The id should be unique.
Upvotes: 0