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

Need help mapping with remote Json

1 Answer 129 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 2
Daniel asked on 17 Sep 2012, 12:43 PM
I am not sure how I should map this data to get it to the datasource. I have read the docs but am not sure how to map this data.  If I change the url back to the demo.kedoui.com/service the data: event fires and binds ok.  With my url I get error event with msg error, but I do not see any data returned or how to fix this so the data is mapped correctly and the data event fires using my url json service.

Thanks

Data:
{"__entityModel":"People","__COUNT":3,"__SENT":3,"__FIRST":0,"__ENTITIES":[{"__KEY":"27","__STAMP":11,"ID":27,"firstName":"dan","lastName":"qqqq"},{"__KEY":"26","__STAMP":14,"ID":26,"firstName":"dan","lastName":"rrrr"},{"__KEY":"25","__STAMP":13,"ID":25,"firstName":"dan","lastName":"eeee"}]}
Code:
   $(document).ready(function () {
                   //var crudServiceBaseUrl = "http://demos.kendoui.com/service",
                  //  var crudServiceBaseUrl = "http://127.0.0.1:8081/rest",
var dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: "http://127.0.0.1:8081/rest/People",
                type: "POST",
                contentType: "application/json; charset=utf-8",
                dataType: "json"
            }
        },
        schema: {
            data: function (data) {
                alert("got data")
                alert(data);   /*Data Return Successfully*/
                return data;
            }
        },
        error: function (e) {
            debugger;
            alert("Error");
        },
        change: function (e) {
            alert("Change");
        },
        requestStart: function (e) {
            debugger;
            alert("Request Start");
        }
    });
 
                    $("#grid").kendoGrid({
                        dataSource: dataSource,
                        pageable: true,
                        height: 400,
                        toolbar: ["create"],
                        columns: [
                            "firstName",
                               "lastName",
                            { command: ["edit", "destroy"], title: " ", width: "210px" }],
                        editable: "inline"
                    });
                });

1 Answer, 1 is accepted

Sort by
0
Christopher Tallos
Top achievements
Rank 1
answered on 30 Nov 2012, 03:18 PM
Hi Daniel,

Did you ever figure this out, if so, can you post the solution?
Tags
Data Source
Asked by
Daniel
Top achievements
Rank 2
Answers by
Christopher Tallos
Top achievements
Rank 1
Share this question
or