This is a migrated thread and some comments may be shown as answers.

Export to CSV Error with serverGrouping:true on DataSource definition

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luiz
Top achievements
Rank 1
Luiz asked on 21 Apr 2016, 03:29 PM

Hi,

My DataSource is presented below in coffescript. I omit some field for simplicty.

version: Kendo UI v2016.1.412

kendo.data.DataSource({
      serverAggregates: true
      serverGrouping: true
     ...
      schema:
        aggregates: 'aggregates'
        data: 'trips'
        total: 'total'
        model:
          id: 'period'
          fields:
            max_speed: {type:'number'}
            avg_speed: {type:'number'}
            trip_distance: {type:'number'}
        groups: (response) ->
         ...
      transport:
        read: (options) -> ...
    })

When I export the CSV, I got the error "Uncaught TypeError: Cannot read property 'data' of undefined"

Looking on the kendo Export source code, I found that when the serverGrouping is enabled, it expects an option object defined in the schema.transport parameter. This code is illustrated bellow.

 (function ($, kendo) {
        kendo.ExcelExporter = kendo.Class.extend({

         ...
var data = dataSource.data();
                    if (data.length > 0) {
                        this.dataSource._data = data;
                        var transport = this.dataSource.transport;
                        if (dataSource._isServerGrouped() && *transport.options*.data) {
                            transport.options.data = null;
                        }
                    }

...

The avaliable documentation does not have any reference to a parameters transport.options (http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-transport). When I defined transport.options: {}, the CSV export works well.

In this context, I would like to know if there is an error in this implementation or if I made any mistake on defining the datasource.

Best Regards,

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 25 Apr 2016, 09:08 AM

Hello Luiz,

 

This is bug in our code and we will address it shortly.

 

Thank you for reporting this.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Luiz
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or