How to change the default text of UI-Grid menu option

旧城冷巷雨未停 提交于 2019-12-12 03:25:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!