I am getting the error: Uncaught TypeError: Cannot read property 'field' of undefined
in the kendo.all.min.js file when trying to post a view model with nested objects.
I have created a jsfiddle to repro the issue, I don't think I'm describing it very well, so take a look, it is short.
http://jsfiddle.net/bNBUP/
Any ideas?
Thanks,
Gary
in the kendo.all.min.js file when trying to post a view model with nested objects.
I have created a jsfiddle to repro the issue, I don't think I'm describing it very well, so take a look, it is short.
http://jsfiddle.net/bNBUP/
Any ideas?
Thanks,
Gary
4 Answers, 1 is accepted
0
Accepted
Hi,
Atanas Korchev
the Telerik team
This is caused by the fact that the toJSON method is not recursive right now. We decided to implement this for the next internal build.
As a workaround you could call toJSON of the nested objects: http://jsfiddle.net/bNBUP/1/
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!
0
Gary
Top achievements
Rank 1
answered on 24 May 2012, 03:09 PM
Thanks for the reply and explanation. I ended up falling back to JSON.stringify (which is completely fine in my opinion - no need for you to reinvent the wheel) since in my real world case the objects were nested several objects deep.
Gary
Gary
0
Kevin
Top achievements
Rank 2
answered on 02 Jun 2012, 01:01 PM
Was this addressed or where can I find an internal build? I couldn't seem to find it for the Kendo UI builds in my subscription. I see where I can download Telerik ASP.NET Ajax internal builds as well as others...
The following was what I ended up implementing to get around the current issue. I do not know what type of model I will be submitting as it is generic and a pass through for any type:
The following was what I ended up implementing to get around the current issue. I do not know what type of model I will be submitting as it is generic and a pass through for any type:
var
tempData = viewModel.toJSON();
$.each(tempData,
function
(i, v) {
if
(v &&
typeof
(v) ==
"object"
) {
tempData[i] = tempData[i].toJSON();
}
});
return
tempData;
This only goes down one level. A recursive function would need to be used to traverse further. Do you know when it is planned to make toJSON() a recursive call?
0
Hi Kevin,
Atanas Korchev
the Telerik team
You could download the latest internal build from the corresponding page on kendoui.com (you have to be logged in): http://www.kendoui.com/account/your-products/product-versions/single-download.aspx?pmvid=2784&pid=949
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!