在Angular ui-grid中删除导出为pdf选项 [英] Remove export to pdf option in Angular ui-grid

查看:82
本文介绍了在Angular ui-grid中删除导出为pdf选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从ui-grid下拉菜单中删除导出为pdf的选项?我想保留导出到csv的功能,但是无法弄清楚如何在不删除所有导出功能的情况下删除pdf功能.

Is there a way to remove the option to export to pdf from the ui-grid dropdown menu? I want to keep the ability to export to csv, but cannot figure out how to remove the pdf feature without removing all export capability.

我从文档中编辑了此插件,以删除所有与pdf出口商有关.这实际上会禁用该功能,但是菜单上仍然可以提供导出为pdf的选项.

I edited this plunker from the docs to remove all of the scripts and JavaScript that are relevant to the pdf exporter. This effectively disables the functionality, but the option to export to a pdf is still available from the menu.

app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
  $scope.gridOptions = {
    columnDefs: [
      { field: 'name' },
      { field: 'gender', visible: false},
      { field: 'company' }
    ],
    enableGridMenu: true,
    enableSelectAll: true,
    exporterCsvFilename: 'myFile.csv',
    exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
    onRegisterApi: function(gridApi){
      $scope.gridApi = gridApi;
    }
  };

推荐答案

在插件的第12行上,添加以下网格选项(默认值为true):

On line 12 in your plunker add the following grid option (the default value is true):

 exporterMenuPdf: false,

导致类似的结果:

app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
  $scope.gridOptions = {
    columnDefs: [
      { field: 'name' },
      { field: 'gender', visible: false},
      { field: 'company' }
    ],
    enableGridMenu: true,
    enableSelectAll: true,
    exporterMenuPdf: false, // ADD THIS
    exporterCsvFilename: 'myFile.csv',
    exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
    onRegisterApi: function(gridApi){
      $scope.gridApi = gridApi;
    }
  };

请参见 http://ui-grid.info/docs/#/api/ui.grid.exporter.api:GridOptions 获取所有可能的选项.

See http://ui-grid.info/docs/#/api/ui.grid.exporter.api:GridOptions for all possible options.

这篇关于在Angular ui-grid中删除导出为pdf选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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