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

Kendo grid. add row. JS error

1 Answer 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fdg
Top achievements
Rank 1
Fdg asked on 16 Feb 2012, 11:30 AM
Hi all,

Ok I have put a problem that many people read but nobody answered. So i guess it would be usefull to make a clearer explaination:

I have a very basic kendo grid bind to odata dataservice:
-----------------------------------------------------------------------

var

myDS = new kendo.data.DataSource({
type: "odata",
transport: {
//read: { url: "/Ajax/Lists/PassagesReports/LightService.svc/PRs/"
read: { url: "/testprs.js" //I put example here of JSON return by Odata so u can test
}},
schema: {
model: {
id:
"SeqId",
fields: prLight}},
pageSize: 10,
serverPaging:
true,
serverFiltering:
true,
serverSorting:
true,
sort: { field:
"SeqId" }
});

//I load it with:
//---------------
$(document).ready(

function () {
$(
"#gridPRs").kendoGrid({
dataSource: myDS,
height:
"auto",
scrollable:
false,
filterable:
true,
columns: [ { title: "Seq.", field: "SeqId", width: "65px", template: "<div class='dprcolpad'>#= SeqId #</div>" },{ title: "Lane", field: "LineId", width: "165px", template: "<div class='dprcolpad'>#= GetLine(LineId) #</div>" },{ title: "Description", width: "230px", field: "Description", template: "<div class='dprcolpad'>#= Description #</div>" }
],
sortable: {
mode: "single",
allowUnsort:
false
},
pageable:
true});

 //Here i defined button add click
//----------------------------------
$("#btadd").click(function () {
prLight.SeqId = "11";
prLight.LineId = 20;
prLight.Description = "London";
myDS.add(prLight);

});
});

//I defined my object :
-----------------------
var prLight = {
SeqId: { type: "string", filterable: false },
LineId: { type:
"number" },
Description: { type: "string" }};

//and finaly and example of odata that u can put in js file testprs.js to make all work:
----------------------------------------------------------------------------------------
 callback({"d" : {"results": [{"SeqId": "1", "LineId": 0, "Description": "London"}, {"SeqId": "5", "LineId": 1, "Description": "Mexico"}], "__count": "2"}})

Ok so far so good. so what the problem then? well if you click add button you get a very strange error :

 "d.d is undefined" from kendo.core.js.

if you change data type from odata to json. it works well. (But i want to use dataservice and odata in this case.

Any one can help?

Thanks
Laurent


1 Answer, 1 is accepted

Sort by
0
T.
Top achievements
Rank 1
answered on 27 Aug 2012, 02:38 PM
Hi,

I face the same error now, could you resolve the problem?

Thanks!
Tags
Grid
Asked by
Fdg
Top achievements
Rank 1
Answers by
T.
Top achievements
Rank 1
Share this question
or