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

Kendo Grid JSON error

1 Answer 211 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 28 Mar 2012, 02:58 PM
I am receiving this error when attempting to bind data from a file with Kendo UI

TypeError: 'undefined' is not an object (evaluating 'b.length')

I'm loading the JSON from a local file (data.json) with a fairly simply datastructure.

here is my data:

{"data":{
"Product":"Bacon",
"Price":19.56123,
"Quantity":5
},
{
"Product":"Pancakes",
"Price":13.91123,
"Quantity":17
}}


and here is my Kendo initializer

$("#remote").kendoGrid({
sortable: true,
dataSource:
{
type: "json",
transport:
{
read: "data.json"
},
schema:
{
data:"data",
/*
model:
{
fields:
{
"Product": { type: "string" },
"Price": { type: "number" },
"Quantity": { type: "number" }
}
}*/
},
pageSize: 3,
serverPaging: false,
serverFiltering: false,
serverSorting: false
},
columns:
[
{
field: "Product",
title: "Product Name"
},
{
field: "Quantity",
title: "Quantity"
},
{
field: "Price",
title: "Price",
template: '#= kendo.toString(Price, "c") #'
}
],
});


The error is the same with or without that Model field commented... I feel like this might be a jQuery dependency error (1.7.1), but I am not sure... any help or thoughts would be appreciated.

Thanks

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 28 Mar 2012, 03:03 PM
Hi,

 Your data is not valid JSON. 

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