问题
I'm using UI-Grid framework to show tabular data with server side pagination and the grid menu turned on. On my "exportAllDataFn" I'm making an Ajax call to the server to pull that data, but I'm limiting the number of rows exported to a few thousand since the data set large enough to crash the browser if "all" data is exported. I want to change the default text of the menu option from "Export all data as CSV" to semething more indicative of what's happening, maybe "Export all data (max 2500 rows)". There does not seem to be a "gridOption" to set this. And after googling the question, didn't find too many good options. I'm using a bit of a hack to accomplish this now, but I feel like there should be a simeple solution. How do I change the title of the dafault menu options?
回答1:
After digging through UI-Grid code, I found a solution that works for me. I'm adding the i18nService to my controller and then changing the "i18nService.get('en').gridMenu.exporterAllAsCsv" property.
app.controller('myCtrl', ['i18nService', function(i18nService){
// . . .
// 'en' for English
i18nService.get('en').gridMenu.exporterAllAsCsv = 'Export all data as CSV (max 2500 rows)';
来源:https://stackoverflow.com/questions/36803718/how-to-change-the-default-text-of-ui-grid-menu-option