PDF Export and detail grids

4 posts, 0 answers
  1. Bob van de Sande
    Bob van de Sande avatar
    4 posts
    Member since:
    Dec 2003

    Posted 26 Sep 2017 Link to this post

    We just upgraded to the latest 2017.3.913 to fix an issue where we couldn't get a good PDF export (AllPages() wasn't working) from a grid with server paging.  That problem was corrected with the update but now we have another PDF export issue.  We have a grid that has row detail grids and is NOT using server side paging.  When the user clicks export, we use the PDF export event to expand all of the detail grids and change the number of rows per page to a large number so that all records will be exported along with the row details.

    function onPdfExport(e) {     

        var grid = e.sender;     

        var pageSize = grid.dataSource.pageSize();     

        grid.dataSource.pageSize(5000);     

        grid.refresh();     

        grid.expandRow(this.tbody.find("tr.k-master-row"));     

       e.promise         

            .done(function () {             grid.dataSource.pageSize(pageSize);             grid.refresh();         });

    }

    The problem we're having happens whether we are using this code to expand all rows OR if we comment out the code and expand a few manually.  If I expand 3 rows, the export is combining the details for each row and showing the detail data for all open rows in all open rows.  I know that is a little difficult to understand...if each of the 3 rows that have been expanded have 1 detail row each then 3 detail rows will export under every expanded row.  See attached images for a clearer description.  These images were generated without the use of the PDF export event handler defined above.  I manually expanded 3 rows before exporting.  The first screenshot is the actual grid showing 3 rows expanded.  The second is the page from the PDF export where you can see that the detail grids are combined.

     

     

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 28 Sep 2017 Link to this post

    Hi Bob,

    Exporting hierarchical Grid is not supported out of the box and this is documented in the "Known limitations" article for the PDF export:
    The problem with the hierarchy is the sequence of the events and the async requests for the data when server operations are enabled. For exporting all nested in the detail templates Grids and changing their page size you could use a custom button, request all records for the parent Grid, expand all records within its dataBound event, change the page size for the nested Grids and only afterwords, when the entire DOM is rendered, export the parent Grid to PDF.

    Another solution would be to allow the user to choose if they want to export the all rows for the masted and the child grid and if so, you could have a custom button that could request and render all master and detail rows before the user clicks on the export button.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Bob van de Sande
    Bob van de Sande avatar
    4 posts
    Member since:
    Dec 2003

    Posted 28 Sep 2017 in reply to Konstantin Dikov Link to this post

    I don't think you read my post completely or maybe I wasn't clear.  Let's try again...

    Let's just forget about my onPdfExport handler as I have removed it and the problem still exists.  Example...The grid is rendered and I expand the details for 3 different rows.  Each of the row details have only 1 detail record.  I perform the export and each of the 3 expanded rows has it's original detail row plus the details from the other 2 expanded rows.  Please refer to the screen shots I attached to the original post.  Neither parent nor detail grids are using server operations and there is no paging for the detail grids.

  4. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 02 Oct 2017 Link to this post

    Hi Bob,

    I tried to replicate the issue locally, but to no avail. Could you please open a regular support ticket with a sample, runnable project replicating the exact issue, so we can debug it locally and see if this is a problem with the configuration or if this is indeed a bug with the latest version, although that as stated in the documentation, exporting hierarchical Grid is not supported out of the box.

    Looking forward to your reply.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 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