Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove some columns in pdf export in angular js ui Grid

I am using Angular JS ui Grid

http://ui-grid.info/docs/#/tutorial/312_exporting_data_complex

My requirement is that I want to show e.g. 5 columns, but when I export PDF, I don't want to export certain columns like username.

How can I do that?

like image 214
user3214546 Avatar asked Jan 07 '15 02:01

user3214546


1 Answers

There is a gridOption to do exactly that: exporterSuppressColumns

I edited the plunker from the UI Grid documentation to demonstrate hiding the "Gender" column in the exported PDF: http://plnkr.co/edit/89ZVlPZcQbHYzgX5l4yq?p=preview

Now whether you select export "all" or export "visible", you will never see the gender column in the output.

  $scope.gridOptions = {
columnDefs: [
  { field: 'name',visible:true },
  { field: 'gender', cellFilter: 'mapGender', exporterPdfAlign: 'right', visible:true, enableHiding: true },
  { field: 'company', visible: false }
],
exporterSuppressColumns: [ 'gender' ],

The documentation is here: http://ui-grid.info/docs/#/api/ui.grid.exporter.api:GridOptions

like image 135
lmyers Avatar answered Sep 30 '22 05:09

lmyers