I am doing a simple app in Kendo Mobile. I have a form that adds to a datasource when you click add. That works great. I am having trouble converting it over to use Jaydata. Here is what I have:
Now I realize I have to define the data schema, then I can just attach it to a listview like I would a normal viewmodel. How do I add to it though? My form is pretty simple just data-binding the fields like so:
All the examples in the blog post on here and on Jaydata's site all are for grids or other things that are editable.
Thanks.
var
alarmsViewModel = kendo.observable({
alarms: [
{ time :
"13:00"
, note :
"Note goes here"
, daysOfWeek :
"Every Monday"
, onOff :
"off"
, snooze :
"off"
, alarmType :
"ring"
},
{ time :
"11:30"
, note :
"Note goes here 2"
, daysOfWeek :
"Every Monday"
, onOff :
"off"
, snooze :
"off"
, alarmType :
"ring"
}
],
add:
function
(e) {
this
.get(
"alarms"
).push({
time:
this
.get(
"time"
),
note:
this
.get(
"note"
),
daysOfWeek:
this
.get(
"daysOfWeek"
),
onOff:
this
.get(
'onOff'
),
snooze:
this
.get(
'snooze'
),
alarmType:
this
.get(
'alarmType'
)
});
e.preventDefault();
},
onClick:
function
(e) {
kendoConsole.log(
"event :: click"
, e);
}
});
<input type=
"time"
data-bind=
"value:time"
>
Thanks.