export excel and pdf export, no file created

3 posts, 0 answers
  1. Sven
    Sven avatar
    1 posts
    Member since:
    Feb 2016

    Posted 04 Feb 2016 Link to this post

    I am trying to create a kendo grid with excel export. My data is shown precisely as I want it and the grid works fine. However, the saveAsExcel function triggers the excelExport event, but no file is created. Same problem with the pdf export. Here is my grid options:

    grid = $("#grid").kendoGrid({
            toolbar:["excel","pdf"],
            height: 500,
            scrollable: true,
            groupable: true,
            sortable: true,
            filterable: false,
            excel: {
                allPages:true,
                filterable:true
            },
            excelExport: function(e) {
                console.log('Firing Export');
                console.log(e.workbook);
                console.log(e.data);
            },
            pdfExport: function(e){
                console.log('PDF export');
     
            },
            columns: [
                { field: "date", title: "Time", template: "#= kendo.toString(kendo.parseDate(date), 'MM/dd/yyyy') #", width: '120px'},
                { field: "customer", title: "Customer" },
                { field: "amount", title: "Total", format: "{0:c}", width: '70px', aggregates: ["sum"]},
                { field: "paid_with", title: "Payment", width: '130px'},
                { field: "source", title: "Source" },
                { field: "sale_location", title: "Sale Location" }
            ]
        }).data("kendoGrid");


    This ajax is called whenever the search parameters for the data is changed. Where I refresh the datasource.

    $.ajax({
               'url':'/POS/ajax/loadTransactionsDetailsForDay.php',
               'data':{
                   filters
               },
               'type':'GET',
               'dataType':'json',
               'success':function(response) {
                   var dataSource = new kendo.data.DataSource({
                       data: response.data.invoices,
                       pageSize: 100000,
                       schema: {
                           model: {
                               fields: {
                                   date: {type: "string"},
                                   customer: { type: "string" },
                                   amount: { type: "number" },
                                   paid_with: {type: "string"},
                                   source: {type:"string"},
                                   sale_location: {type:"string" }
                               }
                           }
                       }
                   });
                   grid.setDataSource(dataSource);
                   grid.refresh();
               }
     
           });

    The output from my console log is.
        Firing Export.
    A worksheet object.
       and and array with these objects for every row in the grid:
    0: o
       _events: Object
       _handlers: Object
       amount: 40.45
       customer: "customer 1"
       date: "2015-11-25T00:00:00-08:00"
       dirty: false
       employee: 23
       paid_with: "Check"
       parent: ()
       sale_location: "Main"
       source: "POS"
       uid: "70b2ba9c-15f7-4ac3-bea5-f1f2e3c800d3"

    I have the latest version of kendo, jquery 2.14, I am loading jszip. I am running it on the latest version of chrome. I have tried all kinds of variations of this code I can think of, including removing my schema, initializing the kendo anew every time in the callback.

    Anyone got any idea why this would not work?
    Every example on this I can find make it look super simple, just create the grid and call export... So I have to have overlooked something.

    I am grateful for any ideas about this.
    Thanks.

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2312 posts

    Posted 08 Feb 2016 Link to this post

    Hello Sven,

    We cannot state for sure what is causing the unexpected behavior. Please send us an isolated runnable example that demonstrates it in action, so we could provide further assistance. I am looking forward to hearing from you.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Lich
    Lich avatar
    6 posts
    Member since:
    Jul 2015

    Posted 16 Feb 2016 in reply to Sven Link to this post

    how big is your data? how many rows?

    if you have big grid, you need to use this one

    KendoUI/2016.1.125/js/pako_deflate.min.js 

    Hope it help to solve your issue

     

Back to Top