I have a grid that needs:
1. Two PDF export buttons and 1 Excel export button.
2. Include the hidden or not visible columns.
3. Change the PDF export look. The export looks like a screen shot of the grid and won't fly with the users.
5 Answers, 1 is accepted
Scratch #3, the format is good now.
To add clarity to Question #1, I need two PDF export buttons. One that will export ALL rows in the grid and one that will only export out the "current grid" rows.
Question #2, I have some hidden and not visible columns that they want on the PDF.
Regarding the questions:
1) This can be achieved using the toolbar template of the Grid, and to add the desired buttons, which will manually call the API method to save the Grid as PDF and Excell:
Please have in mind that exporting a specific row is not supported by the Grid export features. It can only be achieved by exporting the specific DOM element, but this will require additional custom logic. Notice in the example, how a content of a specific DOM element is exported:
2) Please check the following forum thread demonstrating this. Please have in mind that the approach for the PDF and Excel export is the same, just the events are different:
3) I`m glad to hear the styles are as desired.
Telerik by Progress
Concerning Question #2 (how to Export an Excel or PDF, but the columns are hidden on the Grid)
I was able to accomplish this for the Excel Export by hiding the columns (on the top of the view)
After the grid renders, I was able to bind to the excelExport and the add the columns back into the grid for the export:
...but the exportPDF doesn't work. :(
Concerning the Question #1,
I have 3 buttons:
- "Print this page" (exports just the page they are on to PDF)
- "Export all records to PDF" (exports all the grid data to PDF)
- "Export all records to Excel" (exports all the grid data to an Excel File)
The "Export all records to PDF" doesn't get all the data surly because the "All Pages" is false, but it can't be set to true.
Concerning the Question #1 - The pdf option can be set to export allPages, and then the button which will export only the current page can be a custom button which will export the Grid DOM container. Notice how in the example, a specific DOM element is exported. In this scenario the $(".content-wrapper") element can be replaced with the Grid container:
Concerning Question #2 - After additional testing, I can suggest using the following approach for the pdf export: