本文介绍了如何更改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菜单选项的默认文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 03:30