I have an Kendo datasource configured to retrive JSON data from a remote server. The response looks something like this:
[
{
"array":[
{
"moreData":"some string"
},
{
"moreData":"some string"
},
{
"moreData":"some string"
}
],
"moreInfo":"string",
"someMore":22
}
]
and I want to use Kendo Template to build the markup and bind it to the data found inside the observable array. I could not find any documentation or help on Telerik's website to understand how to pull this off (or if it's even possible to pull it off). How do I iterate over the object and bind data to the markup?
Please look at this fiddle to know what I'm trying to do: http://jsfiddle.net/m2sspoos/3/
What's the best way to get this done?
I think that there are some misunderstanding on how binding and templates work in KendoUI. You are binding to an
ObservableObject
but then you pass an argument to a template. If you do this, the binding does nothing and you should use in the template something like:but this will not update the data in your model.
I think that what you should do is:
Template definition:
The
<div>
element as:and finally the initialization as:
Your JSFiddle modified here: http://jsfiddle.net/OnaBai/m2sspoos/5/
And a runnable code snippet: