Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (65 sloc) 2.33 KB
@model Object
@using MvcControlsToolkit.Core.Templates
@using MvcControlsToolkit.Core.TagHelpers
@using MvcControlsToolkit.Core.Views
@using Microsoft.Extensions.Localization
@using System.Globalization
@{
var options = ViewData["Options"] as DefaultServerGridLayoutOptions;
var helpers = new ContextualizedHelpers(ViewContext, Html, User, Component, Url, ViewData["LocalizerFactory"] as IStringLocalizerFactory);
var headerTemplate = options.SubTemplates.FirstOrDefault();
var query = TagContextHelper.GetBindingContext(ViewContext.HttpContext, BindingContextNames.Query)?.Model as QueryDescription;
var groupingType = TagContextHelper.GetTypeBindingContext(ViewContext.HttpContext, BindingContextNames.GroupingType);
}
<table @options.RenderTopContainerAttributes() @Html.Raw(options.CssClass != null ? "class='"+options.CssClass+"'" : "")>
@if(!string.IsNullOrEmpty(options.Caption))
{
<caption>@options.Caption</caption>
}
<thead>
@if (options.Toolbars != null)
{
foreach (var tb in options.Toolbars)
{
if (tb.Key == LayoutStandardPlaces.Header)
{
<tr>
<th class="header-toolbar" colspan="@options.VisibleColumns.ToString(CultureInfo.InvariantCulture)">
@Html.Raw(tb.Value)
</th>
</tr>
}
}
}
@if (headerTemplate != null)
{
foreach (var row in options.Rows)
{
if (row.RowToRender(query, groupingType))
{
options.CurrentRow = row;
@await headerTemplate.Invoke(new ModelExpression(string.Empty, ViewData.ModelExplorer), options, helpers)
}
}
}
</thead>
<tfoot>
@if (options.Toolbars != null)
{
foreach (var tb in options.Toolbars)
{
if (tb.Key == LayoutStandardPlaces.Footer)
{
<tr>
<th class="footer-toolbar" colspan="@options.VisibleColumns.ToString(CultureInfo.InvariantCulture)">
@Html.Raw(tb.Value)
</th>
</tr>
}
}
}
</tfoot>
<tbody @options.RenderRowsContainerAttributes()>
@options.MainContent
</tbody>
</table>