I have a couple of <div>'s that are bound to an observable object. Now I want that object to be bound to the datasource so that when the datasource reads data it automatically updates the bound fields. How do I do it? In other words, I call the web service with dataSource.read() and get the data back....OK, now what?
HTML:
The JSON returned by the web service call:
HTML:
<
div
id
=
"view"
>
Sites Monitored: <
div
data-bind
=
"html: sitesMonitored"
></
div
><
br
/>
Sites Failing: <
div
data-bind
=
"html: sitesFailing"
></
div
>
</
div
>
var
viewModel = kendo.observable({
sitesMonitored: 0,
sitesFailing: 0
});
var
dataSource =
new
kendo.data.DataSource({
transport: {
read:
"/Dashboard/Stats"
,
type:
"get"
}
});
{
"SitesMonitored"
:35,
"SitesFailing"
:4}