删除 Angular ui-grid 中的导出为 pdf 选项
Remove export to pdf option in Angular ui-grid
有没有办法从 ui-grid 下拉菜单中删除导出为 pdf 的选项?我想保留导出到 csv 的功能,但不知道如何在不删除所有导出功能的情况下删除 pdf 功能。
我从文档中编辑了 this plunker 以删除所有与 pdf 导出器相关的脚本和 JavaScript。这实际上禁用了该功能,但菜单中仍然提供导出为 pdf 的选项。
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
):
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。
使用以下选项隐藏Excel导出选项
exporterMenuExcel: false
有没有办法从 ui-grid 下拉菜单中删除导出为 pdf 的选项?我想保留导出到 csv 的功能,但不知道如何在不删除所有导出功能的情况下删除 pdf 功能。
我从文档中编辑了 this plunker 以删除所有与 pdf 导出器相关的脚本和 JavaScript。这实际上禁用了该功能,但菜单中仍然提供导出为 pdf 的选项。
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
):
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。
使用以下选项隐藏Excel导出选项
exporterMenuExcel: false