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

DataSource bug

1 Answer 25 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bruno
Top achievements
Rank 1
Bruno asked on 11 May 2014, 04:11 AM
I don't know if it's a known bug or I'm the only one to realize it, but there is bug when we try to bind or use a DataSource object from a json with one field name called "data".

To demonstrate the problem, the codes below illustrates:

//Creating the DataSource
dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "data/weather.json",
                        dataType: "json"
                    }
                }
});

The JSON file:
[
    {
        "data": "Monday",
        "highTemperature": 28,
        "lowTemperature": 14,
        "image": "shower"
    }, {
        "data": "Tuesday",
        "highTemperature": 35,
        "lowTemperature": 18,
        "image": "sunny"
    }, {
        "data": "Wednesday",
        "highTemperature": 30,
        "lowTemperature": 16,
        "image": "partly-sunny"
    }
]

I intentionally changed the name of the field "day" from the Mobile example to "data".
The DataSource retrieved there is no data (length = 0). But when the json file is requested by AJAX (GET), the data retrieved is the correct json.

I used this name "data" because it's a fake cognate in Portuguese. It means "date" in portuguese. Now I changed this name and it's working. I took a lot of time to realize this, so I decided to write this report.  

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 14 May 2014, 07:45 AM
Hello Bruno,

The data keyword is reserved by the Kendo UI Template and this is causing the issue that you are facing. I would suggest you to use the schema.parse function if you data has "data" property inside, so you can correctly using with the Kendo UI Widgets, here is a documentation article about it:

http://docs.telerik.com/kendo-ui/api/framework/datasource#configuration-schema.parse

Regards,
Kiril Nikolov
Telerik
 

Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

 
Tags
Report a bug
Asked by
Bruno
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or