Kendo Export Not working - when scrolling is enabled

6 posts, 1 answers
  1. Stephan
    Stephan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 02 Dec 2015 Link to this post

    I have a kendo grid within a page which is scrollable and grouped by default.  While exporting data the grid data is not completely rendering.  It shows only the partial data within the view.  How to fix this?

     

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 03 Dec 2015 Link to this post

    Hello Stephan,

    I was unable to reproduce the behavior in the following demo. Do you mean that only the current page is exported? If that is the case, you should enable the allPages option of the Excel export configuration.

    Regards,
    Dimiter Madjarov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Stephan
    Stephan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 03 Dec 2015 Link to this post

    Hi Dimiter,

    Thanks for your response.  Am generating pdf for my Kendo grid.  As my grid is scrollable (shows only first 4 records and rest of the records can be viewed only after scrolling).  All my records are within a single page.  While generating pdf, it is showing the initial records (first 4 records that can be viewed without scrolling ) like a screenshot of the records, not the entire grid.

     Also could you tell me how to set allPages option to true dynamically instead of setting it in kendo grid using js?

  5. Stephan
    Stephan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 03 Dec 2015 in reply to Stephan Link to this post

    Also to add more information, am using mvc kendo grid.  I need to combine three div in the page which include kendo grid div to create a single pdf in an button click event.

     This is my piece of code.

    getPDF: function (sendPdf) {

            var self = this;

            var root = new kendo.drawing.Group();

            //Creating drawing for two form div 
            var x = document.getElementsByClassName(self.selectors.pdfSelector);
            for (var i = 0; i < x.length; i++) {
                kendo.drawing.drawDOM(x[i]).then(function (group) {
                    root.append(group);
                });
            }

            //Creating drawing for Kendo grid
            kendo.drawing.drawDOM(self.selectors.Grid).then(function (group) {
                root.append(group);
            });

            //Appended all those in a single root group

            return kendo.drawing.exportPDF(root, {
                paperSize: "auto",
                margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" },
                multiPage: true
            })
            .done(function (data) {
                // Save the PDF file
                kendo.saveAs({
                    dataURI: data,
                    fileName: "IsciCode.pdf",
                });
            });

     

    My problem is similar to this sample where grid in the pdf is incomplete

    https://demos.telerik.com/kendo-ui/pdf-export/index

     

  6. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 04 Dec 2015 Link to this post

    Hello Stephan,

    I was unable to reproduce the behavior with both, allPages set to true and false. Here is a short example that demonstrates this. The behavior is the same in the MVC Grid.

    Regarding the second question, you could achieve this via JavaScript through the Grid options.
    E.g.

    var grid = $("#grid").data("kendoGrid");
    grid.options.pdf.allPages = false

    If you would like to add additional content to the PDF document and export all Grid pages, you could use the approach from the following help topic.

    Regards,
    Dimiter Madjarov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Stephan
    Stephan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 04 Dec 2015 in reply to Dimiter Madjarov Link to this post

    Thank you so much Dimiter.  This is the part exactly what i expected, which initiate grid pdf creation programmatically.  

    grid._drawPDF(progress)

Back to Top
UI for ASP.NET MVC is VS 2017 Ready