This is great, but how can I add some fields to viewModel?
This is not working:
var
viewModelBase = kendo.data.ObservableObject.extend({
init:
function
() {
kendo.data.ObservableObject.fn.init.call(
this
,
this
);
},
isVisible:
true
,
onSave:
function
(e) {
kendoConsole.log(
"event :: save("
+ kendo.stringify(e.model,
null
, 4) +
")"
);
},
products:
new
kendo.data.DataSource({
schema: {
model: {
id:
"ProductID"
}
},
batch:
true
,
transport: {
read: {
dataType:
"jsonp"
},
parameterMap:
function
(options, operation) {
if
(operation !==
"read"
&& options.models) {
return
{models: kendo.stringify(options.models)};
}
}
}
}),
onMouseClick:
function
() {
kendoConsole.log(
"event :: click"
);
},
onMouseOver:
function
()
{
kendoConsole.log(
"event :: mouseover"
);
},
onMouseOut:
function
()
{
kendoConsole.log(
"event :: mouseout"
);
}
});
var
viewModel =
new
viewModelBase({
test:
"bla"
});
"test" is not bind to anything. For example <div data-bind="html: test"></div> does not print "bla".