or
1.
<
globalization
culture
=
"en-AU"
uiCulture
=
"en-AU"
/>
01.
public
override
object
BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
02.
{
03.
04.
05.
var displayFormat = bindingContext.ModelMetadata.DisplayFormatString;
06.
var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
07.
08.
if
(!
string
.IsNullOrEmpty(displayFormat) && value !=
null
)
09.
{
10.
DateTime date;
11.
displayFormat = displayFormat.Replace(
"{0:"
,
string
.Empty).Replace(
"}"
,
string
.Empty);
12.
// use the format specified in the DisplayFormat attribute to parse the date
13.
14.
bindingContext.ModelState.SetModelValue(bindingContext.ModelName, bindingContext.ValueProvider.GetValue(bindingContext.ModelName));
15.
16.
if
(DateTime.TryParseExact(value.AttemptedValue, displayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None,
out
date))
17.
{
18.
return
date;
19.
}
20.
else
21.
{
22.
bindingContext.ModelState.AddModelError(
23.
bindingContext.ModelName,
24.
string
.Format(
"{0} is an invalid date format"
, value.AttemptedValue)
25.
);
26.
}
27.
}
28.
29.
return
base
.BindModel(controllerContext, bindingContext);
30.
}
Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.CaptureRequest.Title).HtmlAttributes(new { style = "cursor:pointer" }).Title(ContentProvider.Resources.Names.Name);
columns.Bound(p => p.CaptureRequest.StartDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.StartDate);
columns.Bound(p => p.CaptureRequest.EndDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.EndDate);
})
Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.CaptureRequest.Title).HtmlAttributes(new { style = "cursor:pointer" }).Title(ContentProvider.Resources.Names.Name);
columns.Bound(p => p.CaptureRequest.StartDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.StartDate);
columns.Bound(p => p.CaptureRequest.EndDate).Format("{0:dd.MM.yyyy}").Title(ContentProvider.Resources.Names.EndDate);
columns.Command(command => command.Destroy()).Width(90);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events =>
{
events.Error("onGridError");
events.RequestEnd("onGridRequestEnd");
})
.Model(model =>
{
model.Id(p => p.CaptureRequest.ID);
})
.Read(read => read.Action("RequestGridSource/" + @ViewBag.id, "TstvOperation"))
.Destroy(update => update.Action("DeleteActiveCaptureRequest", "TstvOperation"))
)
$(document.body).kendoTouch({
enableSwipe:
true
,
minXDelta: 20,
swipe:
function
(e) {
console.log(
"swipe "
+ e.direction);
alert(
"swipe "
+ e.direction);
if
(e.direction ==
"right"
) {
if
(app.pane.history.length > 1){
app.navigate(
"#:back"
);
}
}
}
}
);$(
'#order_it'
).click(
function
(){
gridNewData.sync();
// this will send data to server
});
complete:
function
(xhr, textStatus) {
if
(textStatus ==
'success'
) {
orders.read();
// this will refresh orders, and grid too, a
gridNewData.data([]);
// empty that temp datasource
}
}
var
orders =
new
kendo.data.DataSource({
autoSync:
false
,
transport: {
read: {
contentType:
'application/json'
,
url:
'/dokument/orders/'
,
dataType:
'json'
,
complete:
function
(xhr, textStatus) {
// i think that here i need to get new synced items(or uids)
}
}
},
schema: {
model: {
id:
'id'
}
}
});
<
div
style
=
"width: 250px; float: left; vertical-align: top; margin: 0 0 auto 0;"
>
<
div
id
=
"statuschart"
></
div
>
</
div
>
<
div
style
=
"width: 250px; float: left; vertical-align: top; margin: 0 0 auto 0;"
>
<
div
id
=
"companychart"
></
div
>
</
div
>
<
div
style
=
"width: 250px; float: left; vertical-align: top; margin: 0 0 auto 0;"
>
<
div
id
=
"divisionchart"
></
div
>
</
div
>
<
script
>
$('#statuschart').kendoChart({
name: "StatusChart",
chartArea: { background: "transparent" },
title: { text: "Facility Status" },
series: [{
type: "pie",
data: [
{ category: "Active", value: 25 },
{ category: "Abandoned", value: 35 },
{ category: "Done", value: 40 }
],
size: 150
}],
legend: { position: "bottom" }
});
$('#companychart').kendoChart({
name: "CompanyChart",
chartArea: { background: "transparent" },
title: { text: "Top Companies" },
series: [{
type: "pie",
data: [
{ category: "Active111111111111", value: 25 },
{ category: "Abandoned11111111111", value: 35 },
{ category: "Done11111111", value: 40 }
],
size: 150
}],
legend: { position: "bottom" }
});
$('#divisionchart').kendoChart({
name: "DivisionChart",
chartArea: { background: "transparent" },
title: { text: "By Division" },
series: [{
type: "pie",
data: [
{ category: "Active111111111111", value: 25 },
{ category: "Abandoned11111111111", value: 35 },
{ category: "Done111111111111", value: 15 },
{ category: "Another1111111111", value: 15 },
{ category: "One1111111111", value: 10 }
],
size: 150
}],
legend: { position: "bottom" }
});
</
script
>