Kendo UI export, excel export and pdf export, not created file

I am trying to create a kendo grid with excel export. My data is displayed exactly as I want, and the grid is working fine. However, the saveAsExcel function fires an excelExport event, but the file is not created. Same problem with pdf export. Here are 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 change. Where am I updating the data source.

  $.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(); } }); 

Exit from my console log.

 Firing Export. 

The worksheet object.

 Object {sheets: Array[1]}sheets: Array[1]0: Objectlength: 1__proto__: Array[0]__proto__: Object 

and and an array with these objects for each 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, I download jszip. I run it on the latest version of chrome. I tried all sorts of variations of this code that I can think of, including deleting my scheme, initializing kendo again every time in the callback.

Has anyone understood why this will not work?

I can find every example on this to make it look super simple, just create a grid and call export ... So I have to miss something.

I am grateful for any ideas about this.

Thanks.

+7
javascript ajax kendo-ui kendo-grid
source share
2 answers

I have the following suggestion.

0
source share

This may be because the file name is missing.

Here is the part with the file name added:

 excel: { allPages:true, filterable:true, fileName: "Kendo UI Grid Export.xlsx" }, 

You can look here: Grid Excel Export

And here for the PDF: Grid Pdf Export

0
source share

All Articles