or
<div id=
"grid"
></div>
$(document).ready(
function
() {
var
crudServiceBaseUrl =
"http://localhost:11028/IntexService.svc/Zonas"
,
crudServiceOptions =
""
,
dataSource =
new
kendo.data.DataSource({
type:
"odata"
,
transport: {
read: {
url: crudServiceBaseUrl + crudServiceOptions,
dataType:
"json"
},
update: {
url:
function
(data) {
return
crudServiceBaseUrl +
"("
+ data.ZonaId +
"L)"
;
}
},
create: {
url: crudServiceBaseUrl
},
destroy: {
url:
function
(data) {
return
crudServiceBaseUrl +
"("
+ data.ZonaId +
"L)"
;
}
}
},
batch:
false
,
pageSize: 10,
serverPaging:
true
,
serverFiltering:
true
,
schema: {
model: {
id:
"ZonaId"
,
fields: {
ZonaId: { editable:
false
, nullable:
true
},
Nombre: { validation: { required:
true
} }
}
},
errors:
"Errors"
},
error:
function
(e) {
alert(
"La operación ha fallado: \n"
+ e.errorThrown +
": "
+ e.xhr.responseText);
this
.cancelChanges();
}
});
$(
"#grid"
).kendoGrid({
dataSource: dataSource,
filterable:
true
,
pageable:
true
,
height: 410,
toolbar: [
"create"
],
columns: [
{ field:
"Nombre"
, width:
"150px"
},
{ command: [
"edit"
,
"destroy"
], title:
" "
, width:
"110px"
}],
editable:
"popup"
});
});
var ds = new kendo.data.DataSource({
transport: {
read: {
url: "donorReadJson.cshtml",
dataType: "json",
type: "POST"
},
update: {
url: "donorUpdateJson.cshtml?" ,
dataType: "json",
contentType: "application/json",
type: "POST",
data: {
donorId: $("#input").val(),
firstname: $("#input").val(),
lastname: $("#input").val(),
homephone: $("#input").val(),
workphone: $("#input").val(),
cellphone: $("#input").val(),
email: $("#input").val()
}
},
destroy: {
url: "/orders/destroy",
data: {
donorId: $("#input").val()
},
},
parameterMap: function (options, operation) {
if (operation != "read") {
return { models: JSON.stringify(options.models) };
}
}
},
schema: {
model: {
id: "donorID",
fields: {
donorID: { type: "number", editable: false, },
title: { type: "string" },
firstname: { type: "string", validation: { required: true } },
middlename: { type: "string" },
lastname: { type: "string", validation: { required: true } },
address: { type: "string" },
city: { type: "string" },
state: { type: "string" },
zipcode: { type: "string" },
homephone: { type: "string" },
workphone: { type: "string" },
cellphone: { type: "string" },
email: { type: "string" }
},
},
},
pageSize: 10,
});
$("#grid").kendoGrid({
dataSource: ds,
autoBind: true,
filterable: false,
resizable: true,
sortable: true,
scrollable: false,
pageable: {input: true, numeric: false },
columns: [
{ field: "firstname", title: "First Name" },
{ field: "lastname", title: "Last Name" },
{ field: "address", title: "Address", hidden: true },
{ field: "city", title: "City", hidden: true },
{ field: "state", title: "State", hidden: true },
{ field: "zipcode", title: "Zip", hidden: true },
{ field: "homephone", title: "Home" },
{ field: "workphone", title: "Work" },
{ field: "cellphone", title: "Cell" },
{ field: "email", title: "Email" },
{ command: ["edit", "destroy"], title: " ", width: "200px" }],
editable: "popup"
});
});
</
script
>
var
gridDataSource =
new
kendo.data.HierarchicalDataSource({
transport: {
read: {
url:
"/services/BookingTotals.ashx"
,
dataType:
"json"
}
},
schema: {
model: {
id:
"Id"
,
hasChildren:
true
,
children: {
transport: {
read: {
url:
"/services/LocationBookingTotals.ashx"
,
dataType:
"json"
}
},
schema: {
model: {
hasChildren:
true
,
id:
"LocationId"
,
children: {
transport: {
read: {
url:
"/services/ServClassBookingTotals.ashx"
,
dataType:
"json"
}
},
schema: {
model: {
hasChildren:
false
,
id:
"ServiceClassGlobalId"
,
}
}
}
}
}
}
}
}
});
$(
"#grid"
).kendoGrid({
groupable:
false
,
scrollable:
true
,
sortable:
true
,
pageable:
true
,
dataSource: gridDataSource
});