or
@model Tsms.Az.Dds.Dto.ViewModels.Classroom.AvailableViewModel
@{
ViewBag.Title = "WebApi";
}
<
h2
>WebApi</
h2
>
<
h3
>MVC Wrappers</
h3
>
<
div
>
@(Html.Kendo()
.Grid<
Tsms.Az.Dds.Dto.ViewModels.Classroom.AvailableGridItem
>()
.Name("AvailableClassesGrid")
.Columns(columns =>
{
columns.Bound(c => c.ClassDateColumn).Title("Date").Width(150)
.ClientTemplate(
"<
span
class
=
'ac#= ClassroomType#-#: LanguageType# ;'
>#= ClassDateColumn#</
span
>" +
"<
br
/><
br
/>" +
"# if ( window.location.pathname.indexOf('/Register/Classroom') == 0 ) { #" +
"<
a
data-tsms
=
'acAction'
class
=
'button red'
><
i
class
=
'icon-ok'
></
i
> Select</
a
>" +
"# } else { #" +
"<
a
href
=
'Register/Classroom?classID=#=ClassroomID#'
data-tsms
=
'acAction'
class
=
'button red'
>Register</
a
>" +
"# } #"
);
columns.Bound(c => c.ClassLocationColumn).Title("Address").Encoded(false).ClientTemplate("<
span
class
=
'ac#= ClassroomType#-#: LanguageType# ;'
>#= ClassLocationColumn#</
span
>");
columns.Bound(c => c.ClassDirectionsColumn).Title("Directions").Width(250).Encoded(false).ClientTemplate("<
span
class
=
'ac#= ClassroomType#-#: LanguageType# ;'
>#= ClassDirectionsColumn#</
span
>");
columns.Bound(c => c.DisplayCity).Visible(false);
columns.Bound(c => c.ClassTimeColumn).Visible(false);
})
.Pageable(p => p.Enabled(Model.GridSettings.PageableSettings.Enabled).PageSizes(Model.GridSettings.PageableSettings.Enabled))
.Sortable(s => s.Enabled(Model.GridSettings.SortableSettings.Enabled))
.Scrollable(s => s.Enabled(Model.GridSettings.ScrollableSettings.Enabled))
.Selectable(s => s.Enabled(Model.GridSettings.SelectableSettings.Enabled))
.Filterable(f => f.Enabled(Model.GridSettings.FilterableSettings.Enabled))
.DataSource(source => source
.Ajax()
.ServerOperation(false)
.Read(read => read.Url("/api/classroom/get-available-grid-list-test").Type(HttpVerbs.Get))
)
.Deferred()
)
</
div
>
<
hr
/>
<
h3
>Client Side</
h3
>
<
div
id
=
"grid"
></
div
>
@section scripts
{
<
script
>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: "/api/classroom/get-available-grid-list-test"
},
pageSize: 5,
serverPaging: false,
serverFiltering: false,
serverSorting: false
},
height: 430,
filterable: true,
sortable: true,
pageable: true,
columns: [{
field: "ClassDateColumn",
filterable: false
},
"ClassLocationColumn"
]
});
});
</
script
>
}
var grid = $("#StudentInvoices").data("kendoGrid");
grid.dataSource.read({ "page": 1, "pageSize": 10, "filter": "Paid~eq~false" })
columns: [
{ field: "BatchNo", width: "150px" },
{ field: "BatchDate",
width: "250px",
format: "{0:dd-MMM-yyyy hh:mm:ss tt}",
parseFormats: ["yyyy-MM-dd'T'HH:mm:ss.zz"] },
{ field: "FileType", width: "250px" },
{ field: "BatchFileName", width: "600px" },
{ field: "BatchRecords", title: "StageCount", width: "150px", template: "\u003cb\u003e\u003ca href=\u0027/#=FileType#/Index?Batchno=#=BatchNo#\u0027\u003e#=BatchRecords#\u003c/a\u003e\u003c/b\u003e" },
{ field: "LoadCount", width: "150px", template: '#=SetLoadColor(BatchRecords,LoadCount,ReportCount)#' },
{ field: "ReportCount", width: "150px", template: '#=SetReportColor(BatchRecords,LoadCount,ReportCount)#' },
{ field: "Status",
width: "150px",
template: "#=Status#",
editor: statusDropDownEditor
},
{ field: "EntityCode", width:"150px" },
{ field: "EntityName", width:"150px" },
{ field: "CreatedBy", width:"200px" },
{ field: "CreatedDate",
width:"250px",
format: "{0:dd-MMM-yyyy hh:mm:ss tt}",
parseFormats: ["yyyy-MM-dd'T'HH:mm:ss.zz"] },
{ field: "ModifiedBy", width:"350px" },
{ field: "ModifiedDate",
width:"250px",
format: "{0:dd-MMM-yyyy hh:mm:ss tt}",
parseFormats: ["yyyy-MM-dd'T'HH:mm:ss.zz"] },
{ command: ["edit"], title:" ", width:"200px"}],
editable: "inline",
pageable: true,
sortable: true,
filterable: true,
columnMenu: true,
resizable: true,
function SetLoadColor(BatchRecords,LoadCount,ReportCount)
{
if(BatchRecords===LoadCount||LoadCount===0 )
return LoadCount;
else
return "<
font
color=\"red\">"+LoadCount+"</
font
>";
}
function SetReportColor(BatchRecords,LoadCount,ReportCount)
{
if(BatchRecords===ReportCount&&LoadCount===ReportCount||ReportCount===0 )
return ReportCount;
else
return "<
font
color=\"red\">"+ReportCount+"</
font
>";
}