有没有办法从ui-grid下拉菜单中删除导出为pdf的选项?我想保留导出到csv的功能,但无法弄清楚如何在不删除所有导出功能的情况下删除pdf功能。
我从文档中编辑了此插件,以删除与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;
}
};
在插件的第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。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句