or
[{
"CustomerId"
:
"60506"
,
"CustomerName"
:
"WILLIAMS COMFORT AIR "
,
"PartNumber"
:
"34.120. "
,
"Vnd"
:
"PV"
,
"SellPrice"
:
" 1.45"
,
"UM"
:
"EA "
,
"Branches"
:[{
"Id"
:2,
"AvailQty"
:0,
"Status"
:
"A"
,
"Location"
:
"St. Louis"
},{
"Id"
:3,
"AvailQty"
:100,
"Status"
:
"A"
,
"Location"
:
"Paducah"
},{
"Id"
:4,
"AvailQty"
:138,
"Status"
:
"A"
,
"Location"
:
"Ft. Wayne"
},{
"Id"
:5,
"AvailQty"
:685,
"Status"
:
"A"
,
"Location"
:
"Indianapolis"
},{
"Id"
:6,
"AvailQty"
:185,
"Status"
:
"A"
,
"Location"
:
"Louisville"
},{
"Id"
:7,
"AvailQty"
:132,
"Status"
:
"A"
,
"Location"
:
"Lexington"
},{
"Id"
:8,
"AvailQty"
:2,
"Status"
:
"A"
,
"Location"
:
"Evansville"
}]}]
<script>
var
dataSource =
null
;
$(
function
() {
});
function
Lookup() {
var
customer = $(
"#customer"
).val();
if
(customer ==
""
) {
customer =
"60506"
;
}
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"api/part/"
,
data: {
partnumber: $(
"#part"
).val(),
customer: customer
}
}
}
});
dataSource.read();
$(
"#partsGrid"
).kendoGrid({
groupable:
true
,
sortable:
true
,
dataSource: {
data: dataSource.data()[0].Branches,
schema:
"Branches"
/*{
model: mySchema
}*/
}
/*,
columns: [{
field: "CustomerId",
title: "Id"
}, {
field : "CustomerName",
title : "Name"
}]*/
});
}
</script>
protected
override
BroadcastEventViewModel CreateEntity(BroadcastEventViewModel entity)
{
var bcEvent =
new
Model.BroadcastEvent()
{
Id = entity.Id,
Name = entity.Name,
StartDate = entity.StartDate,
EndDate = entity.EndDate
};
_repository.InsertBroadcastEvent(bcEvent);
return
entity;
}
var
crudServiceBaseUrl =
"/odata/BroadcastEvents"
;
var
pledgesModel = kendo.observable({
dataSource: broadcastEventDataSource =
new
kendo.data.DataSource({
type:
"odata"
,
transport: {
create: {
url: crudServiceBaseUrl,
dataType:
"json"
,
},
read: {
url: crudServiceBaseUrl,
dataType:
"json"
},
update: {
url:
function
(data) {
return
crudServiceBaseUrl +
"("
+ data.Id +
")"
;
},
dataType:
"json"
},
destroy: {
url:
function
(data) {
return
crudServiceBaseUrl +
"("
+ data.Id +
")"
;
},
dataType:
"json"
}
},
batch:
false
,
serverPaging:
true
,
serverSorting:
true
,
serverFiltering:
true
,
pageSize: 5,
schema: {
data:
function
(data) {
return
data.value;
},
total:
function
(data) {
return
data[
"odata.count"
];
},
errors:
function
(data) {
},
model: {
id:
"Id"
,
fields: {
Id: { type:
"number"
, editable:
false
, nullable:
true
},
Name: { type:
"string"
},
StartDate: { type:
"datetime"
},
EndDate: { type:
"datetime"
},
}
}
},
error:
function
(e) {
var
response = e.xhr.responseJSON;
var
message = response.Message;
//if (e.xhr.responseJSON["odata.error"].Message != null) {
// message = e.xhr.responseJSON["odata.error"].Message;
//}
alert(message +
"\n\n"
);
}
})
});
$(
"#broadcastEventGrid"
).kendoGrid({
dataSource: broadcastEventDataSource,
toolbar: [
"create"
,
"save"
,
"cancel"
],
sortable:
false
,
pageable:
true
,
filterable:
false
,
columns: [
{ field:
"Id"
, title:
"ID"
, width: 150 },
{ field:
"Name"
, title:
"Name"
, width: 200 },
{ field:
"StartDate"
, title:
"Start Date"
, width: 200 },
{ field:
"EndDate"
, title:
"End Date"
, width: 200 },
{
command: [
"edit"
, {
name:
"Details"
,
click:
function
(e) {
// var tr = $(e.target).closest("tr");
//var data = this.dataItem(tr);
alert(
"Details for: "
+ e.target);
}
}], title:
"Action"
,
}
],
editable: {
createAt:
"bottom"
,
mode:
"inline"
}
});