@using MVCGrid.Models
@model MVCGrid.Models.RenderingModel
@helper SortImage(Column col)
{
if (col.SortIconDirection.HasValue)
{
switch (col.SortIconDirection)
{
case MVCGrid.Models.SortDirection.Asc:
break;
case MVCGrid.Models.SortDirection.Dsc:
break;
case MVCGrid.Models.SortDirection.Unspecified:
break;
}
}
}
@helper PageLink(int pageNum, string link, int currentPage)
{
string cls = "";
if (pageNum == currentPage)
{
cls = "active";
}
var liClassAttr = !String.IsNullOrWhiteSpace(cls) ? String.Format(" class='{0}'", cls) : "";
@pageNum
}
@helper PageNextLink(int pageToEnd, PagingModel pagingModel)
{
string cls = "";
if (pageToEnd == pagingModel.CurrentPage)
{
cls = "disabled";
}
string onclick = "";
if (pageToEnd > pagingModel.CurrentPage)
{
onclick = pagingModel.PageLinks[pagingModel.CurrentPage + 1];
}
Next »
}
@helper PagePreviousLink(int pageToStart, PagingModel pagingModel)
{
string cls = "";
if (pageToStart == pagingModel.CurrentPage)
{
cls = "disabled";
}
string onclick = "";
if (pageToStart < pagingModel.CurrentPage)
{
onclick = pagingModel.PageLinks[pagingModel.CurrentPage - 1];
}
« Previous
}
@functions {
string ColumnOnClick(Column col)
{
if (col.Onclick != null)
{
return col.Onclick;
}
return "return false;";
}
string ColumnStyle(Column col)
{
if (col.Onclick != null)
{
return "cursor: pointer;";
}
return "";
}
string RowClass(Row row)
{
if (row.CalculatedCssClass != null)
{
return row.CalculatedCssClass;
}
return "";
}
string CellClass(Cell cell)
{
if (cell.CalculatedCssClass != null)
{
return cell.CalculatedCssClass;
}
return "";
}
}
@foreach (var col in Model.Columns)
{
var thStyleAttr = !String.IsNullOrWhiteSpace(ColumnStyle(col)) ? String.Format(" style='{0}'", ColumnStyle(col)) : "";
@col.HeaderText @(SortImage(col)) |
}
@foreach (var row in Model.Rows)
{
var trClassAttr = !String.IsNullOrWhiteSpace(RowClass(row)) ? String.Format(" class='{0}'", RowClass(row)) : "";
@foreach (var col in Model.Columns)
{
var cell = row.Cells[col.Name];
var tdClassAttr = !String.IsNullOrWhiteSpace(CellClass(cell)) ? String.Format(" class='{0}'", CellClass(cell)) : "";
@Html.Raw(cell.HtmlText) |
}
}
@if (Model.PagingModel != null)
{
var pagingModel = Model.PagingModel;
int pageToStart;
int pageToEnd;
pagingModel.CalculatePageStartAndEnd(5, out pageToStart, out pageToEnd);
Showing @pagingModel.FirstRecord to @pagingModel.LastRecord of @pagingModel.TotalRecords entries
}
@Html.Raw(Model.ClientDataTransferHtmlBlock)