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

查看:35
本文介绍了在 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.

我从文档中编辑了 this plunker 以删除所有脚本和 JavaScript与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;
    }
  };

推荐答案

在 plunker 的第 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天全站免登陆