ui-grid 使用外部分页和导出数据 [英] ui-grid using external Pagination and exporting data
本文介绍了ui-grid 使用外部分页和导出数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用通过外部分页实现的 ui-grid 来显示我的数据.我遇到了一个问题,我只能导出当前查看的数据,但是我也需要能够导出所有数据.
I am currently using ui-grid implemented with external pagination to display my data. I've run into as issue where I can only export the currently viewed data, however I need to be able to export ALL data as well.
有人知道使用外部分页导出所有数据的解决方法吗?
Anyone know a work around to export all data using external pagination?
推荐答案
我最终使用了 ui-grid 中包含的 csvExport 函数.我添加了一个全部导出"自定义菜单项,效果很好!这是我的代码:
I ended up using csvExport function included with ui-grid. I added an "Export All" custom menu item and it works great! Here is my code:
gridMenuCustomItems: [
{
title: 'Export All',
action: function ($event) {
$http.get(url).success(function(data) {
$scope.gridOptions.totalItems = data.totalFeatures;
$scope.gridOptions.data = data.features;
$timeout(function()
{
var myElement = angular.element(document.querySelectorAll(".custom-csv-link-location"));
$scope.gridApi.exporter.csvExport( uiGridExporterConstants.ALL, uiGridExporterConstants.ALL, myElement );
}, 1000);
});
}
}
]
希望这对某人有所帮助!
Hope this helps someone!
这篇关于ui-grid 使用外部分页和导出数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文