or
<
div
data-role
=
"navbar"
>
<
span
data-role
=
"view-title"
></
span
>
<
a
data-align
=
"right"
data-role
=
"button"
class
=
"nav-button"
href
=
"@Url.Action("
Index", "Home")">Home</
a
>
</
div
>
pageable: true,
scrollable: { virtual: true },function
refreshGrid()
{
// get a reference to the grid widget
var
grid = $(
"#grid"
).data(
"kendoGrid"
);
// refreshes the grid
grid.cancelChanges();
grid.refresh();
}
function
SetWindow(val)
{
$(
"#window"
).kendoWindow({
title:
"Async Window Content"
,
content:
"popup.aspx?id="
+ val,
visible:
false
,
close: refreshGrid
});
}
$(document).ready(
function
() {
$(
'#target'
).click(
function
() {
SetWindow(34);
var
window = $(
"#window"
).data(
"kendoWindow"
);
window.center();
window.open();
});
$(
"#grid"
).kendoGrid({
columns: [
{ title:
"Action"
, command:
"destroy"
},
{ field:
"ID"
, visible:
false
},
{ title:
"Status"
, template:
"<A href=;pop.aspx?id=${ ID }'>${ JobRate }</a>"
},
{ field:
"Name"
},
{ field:
"JobRate"
, title:
"Job Rate"
},
{ field:
"Notes"
}
],
editable:
true
,
// enable editing
toolbar: [
"create"
,
"save"
,
"cancel"
],
// specify toolbar commands
dataSource: {
schema: {
data:
"d"
,
// ASMX services return JSON in the following format { "d": <result> }. Specify how to get the result.
model: {
// define the model of the data source. Required for validation and property types.
id:
"ID"
,
fields: {
ID: { editable:
false
, nullable:
true
},
Name: { validation: { required:
true
} },
JobRate: { validation: { required:
true
}, type:
"number"
},
Notes: { validation: { required:
true
} }
}
}
},
batch:
true
,
// enable batch editing - changes will be saved when the user clicks the "Save changes" button
transport: {
},
read: {
url:
"JobsWebService.asmx/GetAllJobs"
,
//specify the URL which data should return the records. This is the Read method of the Products.asmx service.
contentType:
"application/json; charset=utf-8"
,
// tells the web service to serialize JSON
type:
"POST"
//use HTTP POST request as the default GET is not allowed for ASMX
},
parameterMap:
function
(data, operation) {
if
(operation !=
"read"
) {
// web service method parameters need to be send as JSON. The Create, Update and Destroy methods have a "products" parameter.
return
JSON.stringify({ products: data.models })
}
}
}
}
});