If I define my data source independantly of my grid, the paging on the grid doesn't work. I have wasted a couple hours figuring out what the problem is. I can put the data source as part of a grid in this case, though it does make code slightly messier.
If I switch the code back to using the inline definition of the data source then the paging works.
The docs make no mention of this. Is it a bug?
$(document).ready(
function
() {
var
src =
new
kendo.data.DataSource({
transport: {
read: {
url:
"Handlers/TaskHandler.ashx"
,
dataType:
"json"
,
type:
"GET"
,
},
update: {
url:
"Handlers/TaskHandler.ashx"
,
dataType:
"json"
,
type:
"PUT"
,
},
destroy: {
url:
"Handlers/TaskHandler.ashx"
,
dataType:
"json"
,
type:
"DELETE"
,
},
create: {
url:
"Handlers/TaskHandler.ashx"
,
dataType:
"json"
,
type:
"POST"
,
},
parameterMap:
function
(options, operation) {
if
(operation !==
"read"
&& options.models) {
return
{ tasks: kendo.stringify(options.models) };
}
}
},
batch:
true
,
schema: {
model: {
id:
"Id"
,
fields: {
Id: { editable:
false
, nullable:
true
},
Description: { type:
"string"
, editable:
true
},
IsComplete: { type:
"boolean"
, editable:
true
},
Priority: { type:
"number"
, editable:
true
},
CreatedOn: { type:
"date"
, editable:
false
, defaultValue:
new
Date() }
}
}
},
});
$(
'#task-data'
).kendoGrid({
toolbar: [
"create"
,
"save"
,
"cancel"
],
columns: [
{
field:
"Id"
,
width: 44,
title:
"ID"
}, {
field:
"Description"
,
}, {
field:
"Priority"
,
width: 110,
title:
"Prio"
}, {
field:
"IsComplete"
,
width: 90,
title:
"Complete"
} , {
field:
"CreatedOn"
,
width: 120,
title:
"Created"
,
format:
"{0:yyyy-MM-dd}"
}, {
command: [
"destroy"
], title:
""
, width: 120
}
],
pageable: {
pageSize: 5
},
scrollable:
true
,
editable:
true
,
navigatable:
true
,
sortable:
true
,
dataSource: src
//dataSource: {
// transport: {
// read: {
// url: "Handlers/TaskHandler.ashx",
// dataType: "json",
// type: "GET",
// },
// update: {
// url: "Handlers/TaskHandler.ashx",
// dataType: "json",
// type: "PUT",
// },
// destroy: {
// url: "Handlers/TaskHandler.ashx",
// dataType: "json",
// type: "DELETE",
// },
// create: {
// url: "Handlers/TaskHandler.ashx",
// dataType: "json",
// type: "POST",
// },
// parameterMap: function (options, operation) {
// if (operation !== "read" && options.models) {
// return { tasks: kendo.stringify(options.models) };
// }
// }
// },
// batch: true,
// schema: {
// model: {
// id: "Id",
// fields: {
// Id: { editable: false, nullable: true },
// Description: { type: "string", editable: true },
// IsComplete: { type: "boolean", editable: true },
// Priority: { type: "number", editable: true },
// CreatedOn: { type: "date", editable: false, defaultValue: new Date() }
// }
// }
// },
//}
});
});
The docs make no mention of this. Is it a bug?