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

Source and template binding

1 Answer 57 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 09 Jul 2013, 08:03 PM
Dear Sirs,

My question has to do with the sample referenced below.
http://demos.kendoui.com/web/mvvm/source.html
In that example an observable array is created with the following code:
products: [
{ name: "Hampton Sofa", price: 989.99, unitsInStock: 39 },
{ name: "Perry Sofa", price: 559.99, unitsInStock: 17 },
{ name: "Donovan Sofa", price: 719.99, unitsInStock: 29 },
{ name: "Markus Sofa", price: 839.99, unitsInStock: 3 }
]
I have been working on a similar example where I create a template and then bound the template to
an observable object using data that I created similar to the above.  That code worked fine.  When I
tried to create the data from a remote data source using a kendo data source the binding failed. I have looked at the demo where you bind a drop down list to a remote data source
http://demos.kendoui.com/web/mvvm/remote-binding.html
Questions:
1.  Is there an example of how to take  a source and template and bind it to an observable using data from a data source?
2.  How do you create an observable array from a data source?

Scott



1 Answer, 1 is accepted

Sort by
0
Scott
Top achievements
Rank 1
answered on 09 Jul 2013, 08:42 PM
I believe I have found my problem.  I found on one of the post that you need to use data-role( in my example data-role="listview") if you are going to bind data from a data source.  When I made this change it worked.   
Tags
MVVM
Asked by
Scott
Top achievements
Rank 1
Answers by
Scott
Top achievements
Rank 1
Share this question
or