(PDF Export) One page per group

5 posts, 1 answers
  1. Dicom
    Dicom avatar
    3 posts
    Member since:
    Feb 2016

    Posted 31 Jan Link to this post

     Hello,

    is it possible when using the built-in PDF export functionality to make it list each grouped section (created via Ajax().Group()) onto its own page?

    I'm required to create two types of reports. One that exports all items combined into a single report and a second one that exports based on grouping of a specific column. I have the grid grouped correctly but when exporting, I need each group on it's own page rather than displayed all in one grid.

    Is there built-in functionality for this or a known work-around?

    Thank you.

  2. Answer
    Eduardo Serra
    Admin
    Eduardo Serra avatar
    114 posts

    Posted 31 Jan Link to this post

    Hello,

    In order to implement the functionality you describe, use the forcePageBreak selector in the PDF options of the Grid; you can read more about it here, and it would look like:

    pdf: {
      forcePageBreak: ".k-grouping-row:not(:first-child)"
    }

    I encourage you to take a look at the following sample in the Kendo UI Dojo demonstrating the approach described above.

    I hope this helps!

    Regards,
    Eduardo Serra
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Dicom
    Dicom avatar
    3 posts
    Member since:
    Feb 2016

    Posted 31 Jan in reply to Eduardo Serra Link to this post

    Eduardo Serra said:Hello,

    In order to implement the functionality you describe, use the forcePageBreak selector in the PDF options of the Grid; you can read more about it here, and it would look like:

    pdf: {
      forcePageBreak: ".k-grouping-row:not(:first-child)"
    }

    I encourage you to take a look at the following sample in the Kendo UI Dojo demonstrating the approach described above.

    I hope this helps!

    Regards,
    Eduardo Serra
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.

    Hi Eduardo,

    does forcePageBreak exist in the MVC grid pdf component? It doesn't appear so. To implement its usage, would I have to switch from my current Razor ASP MVC grid to the jQuery grid for this page?

  4. Dicom
    Dicom avatar
    3 posts
    Member since:
    Feb 2016

    Posted 01 Feb Link to this post

    I have found a workaround using the .setOptions JS method of the grid that allows me to still use my MVC grid. In case anyone else comes across this issue and wants to stick with the MVC component you can add this JavaScript to your page. Declare all other settings in your original MVC grid. If you have the PDF export button in your toolbar, you'll have re-add it as seen in my example below.

    $('#yourGridName').getKendoGrid().setOptions({
      pdf: {
        forcePageBreak: ".k-grouping-row:not(:first-child)",
      },
      toolbar: ["pdf"]
    });
  5. Eduardo Serra
    Admin
    Eduardo Serra avatar
    114 posts

    Posted 02 Feb Link to this post

    Hello,

    There is no equivalent property in the UI for ASP.NET MVC Wrappers, your approach is valid.

    Thank you for sharing your solution in the Forums.

    Regards,
    Eduardo Serra
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top