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

Print all pages in a Grid

1 Answer 752 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 2
Ian asked on 15 Aug 2013, 08:36 PM
I have a grid with pages which I need to be able to print all at once in one line list of data.

Is there a way to tell the Grid to either re-render with no paging, print, then go back to paging, or to print all data without the paging auto magically?

The user wants the full data printed at once, but likes Paging when using the data on the screen.

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 16 Aug 2013, 09:02 AM
Hello Ian,

It is possible to change the page size of the Grid via pageSize method of the DataSource. This will let you to dynamically change the amount of records displayed by the widget.

If you set the pageSize to be equal to the total amount of records, the Grid will display all items on a single page. For example:
var dataSource = $("#grid").data("kendoGrid").dataSource;
dataSource.pageSize(dataSource.total());

To "go back to paging" simply change the page size again.
I hope this approach will fit in your scenario.
 

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Vishwas
Top achievements
Rank 1
Iron
commented on 01 Dec 2022, 02:04 PM | edited

Hi Alexander,

I am also having the same use case where I want to print all the records available in the grid. As my grid contains thousands of records (~10-20 pages each page contains ~300 records) it is not performant to load all records in the grid while printing as it affects page performance. As of now, I am following https://docs.telerik.com/kendo-ui/controls/data-management/grid/export/print-export link to print grid records. This link only explains current page printing, not the all pages printing. 

Here is my approach to solving this problem, StackOverflow answer has detailed explaination :

https://dojo.telerik.com/@vishwas.upadhyay@neuralt.com/uBAMOpuq

https://stackoverflow.com/questions/35203684/print-all-pages-in-kendo-grid/74644074#74644074 

This solution will be not performant if the record size is too big and the browser page might be unresponsive or the user has to wait too long. Do you have any idea how I should handle this situation? or Printing all the pages of the grid at once is not at all a good idea?

Georgi Denchev
Telerik team
commented on 05 Dec 2022, 08:19 AM

Hi, Vishwas,

In general, attempting to print all of the Grid records at once will always lead to performance issues simply due to the amount of DOM elements that need to be shown on the page at once.

An alternative that I can offer is to use the built-in PDF export functionality of the Grid and once the data is exported, print the PDF file itself. You can enable the allPages property to export the data from all pages.

While this is a two-step process, it should in theory perform better with larger sets of data.

Dojo

Take a look at the following Dojo example where ~800 records are exported relatively quickly:

https://dojo.telerik.com/@gdenchev/UxakejUj 

Best Regards,

Georgi

Tags
Grid
Asked by
Ian
Top achievements
Rank 2
Answers by
Alexander Valchev
Telerik team
Share this question
or