This is a migrated thread and some comments may be shown as answers.

(PDF Export) One page per group

6 Answers 180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dicom
Top achievements
Rank 2
Dicom asked on 31 Jan 2018, 02:08 PM

 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.

6 Answers, 1 is accepted

Sort by
0
Accepted
Eduardo Serra
Telerik team
answered on 31 Jan 2018, 06:09 PM
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.
0
Dicom
Top achievements
Rank 2
answered on 31 Jan 2018, 07:05 PM
[quote]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.

[/quote]

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?

0
Dicom
Top achievements
Rank 2
answered on 01 Feb 2018, 07:10 PM

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"]
});
0
Eduardo Serra
Telerik team
answered on 02 Feb 2018, 03:30 PM
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.
0
Jokull
Top achievements
Rank 1
answered on 21 Jan 2019, 12:09 AM
When I use this solution everything I have in the toolbar disappears. What can I do? I have two datepickers and some links in the toolbar
0
Tsvetina
Telerik team
answered on 22 Jan 2019, 04:34 PM
Hi Jokull,

Try setting the pdf options only via setOptions(), without overwriting the toolbar configuration:
$('#yourGridName').getKendoGrid().setOptions({
  pdf: {
    forcePageBreak: ".k-grouping-row:not(:first-child)",
  }
});


Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Dicom
Top achievements
Rank 2
Answers by
Eduardo Serra
Telerik team
Dicom
Top achievements
Rank 2
Jokull
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or