or
<
div
data-role
=
"view"
data-title
=
"Form Unexpected but nice"
data-init
=
"ns.viewA.init"
data-before-show
=
"ns.viewA.beforeShow"
data-show
=
"ns.viewA.show"
data-model
=
"ns.viewA.viewModel"
>
...
<
select
data-bind
=
"source:options,value:underlying.optionId"
data-text-field
=
"display"
data-value-field
=
"id"
></
select
>
...
</
div
>
01.
(
function
($, kendo, ns){
02.
var
model = {
03.
options: [],
04.
underlying:
null
05.
};
06.
07.
model.bind(
'change'
,
function
(e) {
08.
var
t;
09.
console.info(
'field %s changed.'
, e.field);
10.
if
(e.field ===
'underlying.optionId'
) {
11.
t = viewModel.options.singleOrDefault(
'id'
, model.underlying.optionId);
12.
viewModel.set(
'model.underlying.derivedValue'
, t.someValue);
13.
}
14.
});
15.
16.
ns.viewA = {
17.
init:
function
(){
18.
// populate options
19.
...
20.
},
21.
beforeShow:
function
(){
22.
},
23.
show:
function
(){
24.
model.set(
'underlying'
, {
25.
optionId:
null
,
26.
derivedValue:
'Not Set'
27.
});
28.
},
29.
viewModel: model
30.
};
31.
}(jQuery, kendo, myApp));
1.
<
ul
data-role
=
'listview'
><
li
>static option/information</
li
></
ul
>
@(Html.Kendo().Grid(Model.listEvents)
.Name("Grid2")
.Columns(columns =>
{
columns.Bound(p => p.production_date)
.Title("Date")
.ClientTemplate("#= kendo.toString(production_date, \"MM/dd/yyyy\")#");
columns.Bound(p => p.shift_name).Title("Shift");
columns.Bound(p => p.timestamp).Title("Time").ClientTemplate("#= kendo.toString(timestamp, \"hh:mm:ss\")#");
columns.Bound(p => p.responsible).Title("Responsible");
columns.Bound(p => p.area_name)
.Title("Area")
;
columns.Bound(p => p.alarm_message).Title("Alarm Message");
columns.Bound(p => p.comment).Title("Comment");
columns.Bound(p => p.charged_seconds)
.Title("Charged Time (min)")
.ClientTemplate("#= kendo.toString(charged_seconds, \"n2\")#")
.ClientFooterTemplate("<
div
>Min: #= min #</
div
><
div
>Max: #= max #</
div
>");
})
.DataSource(dataSource => dataSource
.Ajax()
.Group(groups => groups
.Add(p => p.area_name))
)
.HtmlAttributes(new { style = "border: 3px solid #666666" })
)
@(Html.Kendo().Grid(Model.listEvents)
.Name("Grid2")
.Columns(columns =>
{
columns.Bound(p => p.production_date)
.Title("Date")
.ClientTemplate("#= kendo.toString(production_date, \"MM/dd/yyyy\")#");
columns.Bound(p => p.shift_name).Title("Shift");
columns.Bound(p => p.timestamp).Title("Time").ClientTemplate("#= kendo.toString(timestamp, \"hh:mm:ss\")#");
columns.Bound(p => p.responsible).Title("Responsible");
columns.Bound(p => p.area_name)
.Title("Area")
.Hidden(true)
.GroupHeaderTemplate(@<
text
>Area: @item.Key</
text
>)
.ClientGroupHeaderTemplate("Fournd in Area: #= value")
;
columns.Bound(p => p.alarm_message).Title("Alarm Message");
columns.Bound(p => p.comment).Title("Comment");
columns.Bound(p => p.charged_seconds)
.Title("Charged Time (min)")
.ClientTemplate("#= kendo.toString(charged_seconds, \"n2\")#")
.ClientFooterTemplate("<
div
>Min: #= min #</
div
><
div
>Max: #= max #</
div
>");
})
.DataSource(dataSource => dataSource
.Ajax()
.Group(groups => groups
.Add(p => p.area_name))
)
.HtmlAttributes(new { style = "border: 3px solid #666666" })
)