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

Trying to get data from a local json file.

3 Answers 343 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Pedro
Top achievements
Rank 2
Pedro asked on 28 Dec 2011, 11:02 PM
Hello,

I need some help connecting to a json file.

I have attached my html file and my json file.

I can't get the json data to show up in my grid.

Please help,

P

3 Answers, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 29 Dec 2011, 09:19 AM
Hello,

 You have to set the dataType of the transport to json:

transport: {
  url: "data.json",
  dataType: "json"
}

Regards,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Pedro
Top achievements
Rank 2
answered on 29 Dec 2011, 06:16 PM
Hello Petyo,

First of all, thank you very much. Your help worked.

I have another question now, I'm trying to follow along on the video of the kendo ui datasource on youtube.

When the person instructing the screencast moves on to adding in a "POST" to the json file, I get confused.
Because he "reads" from "/weapons.json" but when he "creates" he does it to "/weapons/create.json". 
Is this a separate json file?

At the same time, I want to be able to achieve what he did, as in create a new item in his json file. 
Can you please instruct me on how to do so?

I will attach my current html and json file.

Please help,

Thanks,

P
0
Atanas Korchev
Telerik team
answered on 30 Dec 2011, 10:04 AM
Hello,

 In the video create.json is a remote service which creates items. There is no way to write to JSON files entirely from JavaScript. You need to implement some server side endpoint which will write to the file. We have a few blog posts showing how CRUD works:

http://www.kendoui.com/blogs/archive/11-11-07/batch_crud_operations_with_kendo_ui_datasource.aspx 
http://www.kendoui.com/blogs/teamblog/posts/11-10-18/datasource_syncing_and_models_in_beta_2.aspx 

Please open a new forum thread should you have other questions.

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
Data Source
Asked by
Pedro
Top achievements
Rank 2
Answers by
Petyo
Telerik team
Pedro
Top achievements
Rank 2
Atanas Korchev
Telerik team
Share this question
or