or
@(Html.Kendo().Grid<
Models.Location
>()
.Name("availableStops")
.BindTo((IEnumerable<
Models.Location
>)ViewBag.AvailableLocations)
.Columns(columns =>
{
columns.Bound(p => p.Id).Title("ID");
columns.Bound(p => p.StopLocation).Title("Description");
columns.Template(@<
text
></
text
>).ClientTemplate("<
span
class
=
'k-icon k-add'
title
=
'Add'
style
=
'cursor:pointer;'
onclick
=
'addStop(this)'
></
span
>").Title("Add");
})
.DataSource(dataSource => dataSource.Server().Model(model => model.Id(p => p.IRN)))
)
@(Html.Kendo().Grid<
SpyMobileLibraryRoute.Models.UISpyFmtLOC
>()
.Name("availableStops")
.Columns(columns =>
{
columns.Bound(p => p.Id).Title("ID");
columns.Bound(p => p.StopLocation).Title("Description");
columns.Template(@<
text
></
text
>).ClientTemplate("<
span
class
=
'k-icon k-add'
title
=
'Add'
style
=
'cursor:pointer;'
onclick
=
'addStop(this)'
></
span
>").Title("Add");
})
.DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("GetLocations", "Location")))
)
var DataSource = new kendo.data.DataSource({
pageSize: 5,
transport: {
read: "data.php",
dataType: "json",
},
error: function(e) {
alert(e.responseText);
},
sort: { field: "date", dir: "desc" },
schema: {
model: {
id: "id",
fields: {
item: { type: "string" },
date: { type: "date", "string" },
total:{ type: "string" },
status: { type: "string" },
isnew: { type: "string" },
dispatched: { type: "string" }
}
}
}
});
<
div
data-role
=
"view"
id
=
"list"
data-init
=
"listinit"
>
<
h2
>List</
h2
>
<
ul
id
=
"list"
></
ul
>
</
div
>
<
script
id
=
"list_template"
type
=
"text/x-kendo-template"
>
#
if(status == 1){
var statusText = 'Open';
var statusColour = 'green';
} else if(status == 2) {
var statusText = 'Closed';
var statusColour = 'blue';
} else {
var statusText = 'Problem';
var statusColour = 'red';
}
#
<
div
style
=
"font-size:70%;padding-right:10%"
><
div
style
=
"float:left;margin-right:3px;"
>ID. #= id#</
div
><
div
style
=
"float:right;"
>#= date #</
div
><
div
style
=
"clear:both;text-align:center;padding: 0 5px;width: 60px;float:left;background-color:#= statusColour #; color: white;font-weight:bold"
>#= statusText #</
div
><
div
style
=
"float:right;margin-right:3px;"
>Total: #= total #</
div
><
div
style
=
"clear:both;"
></
div
></
div
></
a
></
script
>
<
script
>
function listinit(){
$("#list").kendoMobileListView({
dataSource: DataSource,
pullToRefresh: true,
appendOnRefresh: false,
style: "inset",
endlessScroll: true,
scrollTreshold: 30, //treshold in pixels
template: $("#list_template").text()
});
}
</
script
>
[[
"Advantage"
,
null
,
"2012-05-07T01:54:02.130000"
,
"sqlsvrautosysjobs"
,
"2012-05-07T01:54:02.130000"
,
"sqlsvrautosysjobs"
, 1], [
"ALDOP"
,
null
,
"2012-05-07T01:54:02.130000"
,
"sqlsvrautosysjobs"
,
"2012-05-07T01:54:02.130000"
,
"sqlsvrautosysjobs"
, 1]]
$(
"#grid"
).kendoGrid({
dataSource: {
type:
"json"
,
transport: {
read: {
url:
'list'
,
dataType:
'json'
,
contentType:
'application/json'
}
},
schema: {
model: {
fields: {
SourceSystem: { type:
"string"
},
ModifiedComment: { type:
"string"
},
CreatedDate: { type:
"date"
},
ModifiedDate: { type:
"date"
},
ModifiedUser: { type:
"string"
},
Version: { type:
"number"
}
}
}
},
pageSize: 10,
serverPaging:
true
,
serverFiltering:
true
,
serverSorting:
true
},
height: 250,
filterable:
true
,
sortable:
true
,
pageable:
true
,
columns: [{
field:
"SourceSystem"
,
title:
"Source"
}, {
field:
"ModifiedComment"
,
title:
"Comment"
,
filterable:
false
},
"Version"
,
{
field:
"CreatedDate"
,
title:
"Created Date"
,
width: 100,
format:
"{0:MM/dd/yyyy}"
}, {
field:
"ModifiedDate"
,
title:
"Modified Date"
,
width: 100,
format:
"{0:MM/dd/yyyy}"
}, {
field:
"ModifiedUser"
,
title:
"Modified By"
}
]
});