or
var
grid = $(
"#daily-tasks-detail-grid"
).kendoGrid({
dataSource: {
transport: {
read: {
url:
'/json/ords'
,
dataType:
'json'
}
}
},
columns: [
{ title:
"Worker"
},
{ title:
"Description"
}
],
rowTemplate: kendo.template($(
"#rowTemplate"
).html())
}).data(
'kendoGrid'
);
<
script
id
=
"rowTemplate"
type
=
"text/x-kendo-tmpl"
>
<
tr
role
=
"row"
>
<
td
role
=
"gridcell"
></
td
>
<
td
role
=
"gridcell"
></
td
>
</
tr
>
<
tr
role
=
"row"
>
<
td
role
=
"gridcell"
></
td
>
<
td
role
=
"gridcell"
></
td
>
</
tr
>
</
script
>
$(
"#scheduler"
).kendoScheduler({
date:
new
Date(
"2013/6/13"
),
startTime:
new
Date(
"2013/6/13 07:00 AM"
),
height: 600,
views: [
"day"
,
{ type:
"week"
, selected:
true
},
"month"
,
"agenda"
],
timezone:
"Etc/UTC"
,
save: scheduler_save,
remove: scheduler_remove,
edit: scheduler_edit,
cancel: scheduler_cancel,
dataSource: {
batch:
true
,
transport: {
read: {
url:
"/Team/Calendar/PopulateCalendar/"
,
dataType:
"json"
,
},
//update: {
// url: "/Team/Calendar/UpdateAppointment/",
// dataType: "json"
//},
//create: {
// url: "/Team/Calendar/CreateAppointment/",
// dataType: "json"
//},
//destroy: {
// dataType: "jsonp"
//},
parameterMap:
function
(options, operation) {
if
(operation !==
"read"
&& options.models) {
return
{ models: kendo.stringify(options.models) };
}
}
},
schema: {
model: {
id:
"taskId"
,
fields: {
taskId: { from:
"TaskID"
, type:
"number"
},
title: { from:
"Title"
, defaultValue:
"No title"
, validation: { required:
true
} },
start: { type:
"date"
, from:
"Start"
},
end: { type:
"date"
, from:
"End"
},
startTimezone: { from:
"StartTimezone"
},
endTimezone: { from:
"EndTimezone"
},
description: { from:
"Description"
},
recurrenceId: { from:
"RecurrenceID"
},
recurrenceRule: { from:
"RecurrenceRule"
},
recurrenceException: { from:
"RecurrenceException"
},
ownerId: { from:
"OwnerID"
, defaultValue: 1 },
isAllDay: { type:
"boolean"
, from:
"IsAllDay"
}
}
}
},
resources: [
{
field:
"ownerId"
,
title:
"Owner"
,
dataSource: [
{ text:
"Alex"
, value: 1, color:
"#f8a398"
},
{ text:
"Bob"
, value: 2, color:
"#51a0ed"
},
{ text:
"Charlie"
, value: 3, color:
"#56ca85"
}
]
}
]
}
})
});
{
"d"
: {
"Data"
:
null
,
"Groups"
: [
{
"aggregates"
: [],
"field"
:
"Comment"
,
"value"
:
"abc"
,
"hasSubgroups"
:
false
,
"items"
: [
{
"Id"
: 2,
"Comment"
:
"abc"
},
{
"Id"
: 6,
"Comment"
:
"abc"
}
]
},
{
"aggregates"
: [],
"field"
:
"Comment"
,
"value"
:
null
,
"hasSubgroups"
:
false
,
"items"
: [
{
"Id"
: 110,
"Comment"
:
null
}
]
}
],
"Total"
: 3
}
}
<!DOCTYPE html>
<
html
>
<
head
>
<
title
></
title
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2013.2.716/styles/kendo.default.min.css"
>
<
script
src
=
"http://cdn.kendostatic.com/2013.2.716/js/jquery.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2013.2.716/js/kendo.web.min.js"
></
script
>
</
head
>
<
body
>
<
script
>
var viewModel = kendo.observable({
dataSource: new kendo.data.DataSource({
transport: {
read: {
url: "MyService.asmx/GetData",
dataType: "json",
contentType: "application/json; charset=utf-8",
type: "POST"
},
parameterMap: function (data, type)
{
return kendo.stringify({
take: data.take,
skip: data.skip,
sort: data.sort || [],
group: data.group || [],
filter: data.filter || null
});
}
},
schema: {
data: "d.Data",
total: "d.Total",
groups: "d.Groups",
model: {
fields: {
Id: { type: 'number' },
Comment: { type: 'string' }
}
}
},
pageSize: 100,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
serverGrouping: true
}),
onItemSelected: function (e)
{
alert('checkbox clicked');
}
});
$(document).ready(function ()
{
kendo.bind(document.body, viewModel);
});
</
script
>
<
div
data-bind
=
"source: dataSource"
data-role
=
"grid"
data-groupable
=
"true"
data-pageable
=
"false"
data-columns="[{ template: '<input type=\'checkbox\' data-bind=\'events: {click:onItemSelected}\'/>'},{ title:'ID', field: 'Id' },{ title: 'Comment', field: 'Comment' }]">
</
div
>
</
body
>
</
html
>
01.
function
flattenGroups(data) {
02.
var
idx, length, result = [];
03.
04.
for
(idx = 0, length = data.length; idx < length; idx++) {
05.
if
(data[idx].hasSubgroups) {
06.
result = result.concat(flattenGroups(data[idx].items));
07.
}
else
{
08.
result = result.concat(data[idx].items);
09.
}
10.
}
11.
return
result;
12.
}
01.
function
flattenGroups(data) {
02.
var
idx, length, result = [];
03.
04.
for
(idx = 0, length = data.length; idx < length; idx++) {
05.
if
(data[idx].hasSubgroups) {
06.
result = result.concat(flattenGroups(data[idx].items));
07.
}
else
{
08.
result = result.concat(data[idx].items.slice());
09.
}
10.
}
11.
return
result;
12.
}