如何更改 UI-Grid 菜单选项的默认文本 [英] How to change the default text of UI-Grid menu option

查看:36
本文介绍了如何更改 UI-Grid 菜单选项的默认文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 UI-Grid 框架来显示带有服务器端分页和网格菜单打开的表格数据.在我的exportAllDataFn"上,我正在向服务器发出 Ajax 调用以提取该数据,但我将导出的行数限制为几千,因为如果所有"数据是大到足以使浏览器崩溃的数据集出口.我想将菜单选项的默认文本从将所有数据导出为 CSV"更改为更能说明正在发生的事情,也许是导出所有数据(最多 2500 行)".似乎没有gridOption"来设置它.在谷歌搜索问题后,没有找到太多好的选择.我现在正在使用一些技巧来完成此操作,但我觉得应该有一个简单的解决方案.如何更改 dafault 菜单选项的标题?

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?

推荐答案

在深入研究 UI-Grid 代码后,我找到了一个适合我的解决方案.我将 i18nService 添加到我的控制器,然后更改i18nService.get('en').gridMenu.exporterAllAsCsv"属性.

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)';

这篇关于如何更改 UI-Grid 菜单选项的默认文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆