How do I print on separate pages rows grouped by a value or attribute?

How do I print on separate pages rows grouped by a value or attribute?

elangelelangel Posts: 1Questions: 1Answers: 0
edited February 2020 in Free community support

I've got a table that shows data for multiple suppliers and it has a "Supplier" column with the name of the supplier. My intention is that when I hit print, I would get all rows related to one supplier in one page, all rows related to another supplier on another page and so on ending up with a big print with lots of pages and each suppliers on a separate page.

I'm thinking of either filtering/grouping those results by the column value which is the supplier name or by some attribute that I could add to those rows depending on their value.

However, my issue is that I don't know how to use the exportoptions and rows to make this filtering/grouping happen and also I don't know how to split them into different pages.

Here is my print button:

{
   extend: 'print',
   className: 'btn btn-smallest btn-primary btn-mini',
   text: 'Print Report',
   title: 'Report' + selectedAgent,
   orientation: 'landscape',
   footer: true,
   customize: function ( win ) {
      $(win.document.body).css( 'font-size', '10pt' ),
      $(win.document.body).find('h1').css('font-size', '12pt'),
      $(win.document.body).find( 'table' ).addClass( 'compact' ).css( 'font-size', 'inherit' );
   },
   exportOptions: {
      rows:{
         ...?
         }
      }
   },

Here is a sample of the table:

Please point me in the right direction, I've been looking at the documentation and can't figure out a way to combine those API options to get what I'm looking for

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    I don't believe that's possible as you're reordering and filtering the table during the print process. I suspect you would need to use the pdfmake API and trigger that yourself, possibly from within a Buttons.

    Colin

This discussion has been closed.