Delete export to pdf file in Angular ui-grid

Is there a way to remove the option to export to pdf from the ui-grid dropdown menu? I want to keep the export option to csv, but I can’t figure out how to remove the PDF function without removing all export options.

I edited this plunker from the docs to remove all scripts and JavaScript that are related to the pdf exponent. This effectively disables the functionality, but the export option to pdf is still available in 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;
    }
  };
+4
source share
1 answer

On line 12 of your plunker, add the following grid parameter (default value true):

 exporterMenuPdf: false,

leads to something like:

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 .

+24

Source: https://habr.com/ru/post/1598811/


All Articles