or
var
oPersonForm =<br>[<br> { Key:
"Type"
, Type:
"select"
, Label:
"Type"
, HightLight:
false
, Values: [{ Key:
"Type1"
, Value:
"Type1"
}, { Key:
"Type2"
, Value:
"Type2"
}, { Key:
"Type3"
, Value:
"Type3"
}] }<br>];<br><br>$(
function
()<br>{<br> Data.Person = {<br><br> dsFields:
new
kendo.data.DataSource({<br> transport: {<br> read:
function
(options)<br> {<br> options.success(oPersonForm);<br> }<br> }<br> }),
<
div
id
=
"personViewForm"
data-role
=
"content"
><
br
> <
ul
id
=
"lsFields"
data-role
=
"listview"
data-style
=
"inset"
data-template
=
"ul-fromPersonTemplate"
data-bind
=
"source: dsFields"
></
ul
><
br
> </
div
><
br
><
br
> <
script
><
br
> var viewModel = kendo.observable({<
br
> dsFields: Data.Person.dsFields<
br
> });<
br
><
br
> kendo.bind($("ul"), viewModel);<
br
> </
script
><
br
><
br
><
script
id
=
"ul-fromPersonTemplate"
type
=
"text/x-kendo-template"
><
br
> <
span
data-bind
=
"text:Label"
></
span
><
br
><
br
> #if (Type == 'checkbox') {#<
br
> <
input
type
=
"checkbox"
<br> data-role="switch" <
br
> name="#: Key #" <
br
> data-checked="#: oPerson[Key] #" /><
br
> #} else if(Type == 'select') {#<
br
> <
select
<br> name="#: Key #" <
br
> data-value-field="Key" <
br
> data-text-field="Value" <
br
> data-bind="value : "Type1", source: this.Values"></
select
><
br
> #} else {#<
br
> <
input
type
=
"#: Type #"
<br> name="#: Key #" <
br
> value="#: oPerson[Key] #" /><
br
> # } #<
br
></
script
><
br
>
<
div
id
=
"test-view"
data-role
=
"view"
data-title
=
"Test"
data-layout
=
"default-layout"
data-init
=
"app.test.init"
data-show
=
"app.test.showView"
>
<
ul
id
=
"test-list"
class
=
"ul-content"
data-role
=
"listview"
>
</
ul
>
</
div
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"endless-scrolling-template"
>
<
li
>#: name#</
li
>
</
script
>
(
function
(global) {
var
app = global.app = global.app || {};
app.test = {
init:
function
(e) {
$(
"#test-view ul#test-list"
).kendoMobileListView({
dataSource:
new
kendo.data.DataSource({
type:
"json"
,
serverPaging:
true
,
pageSize: 50,
transport: {
read: {
dataType:
"json"
}
},
schema: {
type:
"json"
,
data:
function
(data) {
return
data.result;
},
total:
function
(data) {
return
data.total;
}
}
}),
template: $(
"#endless-scrolling-template"
).text(),
endlessScroll:
true
});
},
showView:
function
(e) {
$(
"#loading-overlay"
).show();
app.application.showLoading();
setTimeout(
function
() {
$(
"#loading-overlay"
).hide();
app.application.hideLoading();
}, 2000);
e.view.scroller.reset();
}
};
})(window);
{
"result"
:[{
"name"
:
"Item 1"
},{
"name"
:
"Item 2"
},{
"name"
:
"Item 3"
},{
"name"
:
"Item 4"
},{
"name"
:
"Item 5"
},{
"name"
:
"Item 6"
},{
"name"
:
"Item 7"
},{
"name"
:
"Item 8"
}],
"total"
:8}
{
"filters":[
{
"field":"username",
"operator":"contains",
"value":"bob"
},
{
"field":"username",
"operator":"contains",
"value":"john"
}
]
}