How to Get RADGRID to print Entire Grid - Not just first page when using RADGRID.PRINT

1 Answer 152 Views
Grid
Doug
Top achievements
Rank 1
Doug asked on 07 Oct 2021, 08:42 PM

Can the Radgrid print function print a multi page grid?

My grid just prints out the first page - it is more like a print screen function  than a print grid function.

 

Thank You

 

Doug Juola

djuola@cox.net

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 12 Oct 2021, 03:11 PM

Hello Doug,

The Print feature is a client-side functionality of the browser, and it can only print visible HTML elements. If you want to include all the Grid rows for printing, you need to disable the paging. That will tell the grid to render all the Rows at once.

Please take a look at the On button Click Print Grid Data forum post where you can find instructions for print the RadGrid element and using the approach from the Page for client-side export Code Library sample you can disable/enable paging using AJAX request.

Using the combination of the two artciels, the JavaScript method could be something like:

function PrintRadGrid(radGrid) {
    // disable paging
 
    setTimeout(function () {
        var previewWnd = window.open('about:blank', '', '', false);
        var styleStr = "<html><head><link href='Styles.css' rel='stylesheet' type='text/css'></link></head>";
        var htmlcontent = styleStr + "<body>" + $find(radGrid).get_element().outerHTML + "</body></html>";
        previewWnd.document.open();
        previewWnd.document.write(htmlcontent);
        previewWnd.document.close();
        previewWnd.print();
        previewWnd.close();
    }, 100);
 
    // enable paging
}

Please give it a try and let us know how it goes.

 

Regards,
Vessy
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Doug
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or