|
@using Signum.Entities.DynamicQuery
@using Signum.Entities.Reflection
@using Signum.Web.Properties
@using Signum.Engine
@model Context
@{ FindOptions findOptions = (FindOptions)ViewData[ViewDataKeys.FindOptions];
QueryDescription queryDescription = (QueryDescription)ViewData[ViewDataKeys.QueryDescription];
var entityColumn = queryDescription.Columns.Single(a => a.IsEntity);
Type entitiesType = Reflector.ExtractLite(entityColumn.Type);
Implementations implementations = entityColumn.Implementations;
bool viewable = findOptions.View && (implementations != null || Navigator.IsNavigable(entitiesType, true));
ResultTable queryResult = (ResultTable)ViewData[ViewDataKeys.Results];
Dictionary<int, Func<HtmlHelper, object, MvcHtmlString>> formatters = (Dictionary<int, Func<HtmlHelper, object, MvcHtmlString>>)ViewData[ViewDataKeys.Formatters];}
@if (ViewData.ContainsKey(ViewDataKeys.MultipliedMessage))
{
<tr class="sf-tr-multiply">
<td class="sf-td-multiply ui-state-highlight" colspan="@(queryResult.Columns.Count() + (viewable ? 1 : 0) + (findOptions.AllowMultiple.HasValue ? 1 : 0))">
<span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
@ViewData[ViewDataKeys.MultipliedMessage]
</td>
</tr>
}
@foreach (var row in queryResult.Rows)
{
Lite entityField = row.Entity;
<tr data-entity="@entityField.Key()">
@if (findOptions.AllowMultiple.HasValue)
{
<td>
@if (findOptions.AllowMultiple.Value)
{
@Html.CheckBox(
Model.Compose("rowSelection", row.Index.ToString()),
new { value = entityField.Id.ToString() + "__" + Navigator.ResolveWebTypeName(entityField.RuntimeType) + "__" + entityField.ToStr });
}
else
{
@Html.RadioButton(
Model.Compose("rowSelection"),
entityField.Id.ToString() + "__" + Navigator.ResolveWebTypeName(entityField.RuntimeType) + "__" + entityField.ToStr);
}
</td>
}
@if (viewable)
{
<td>
@QuerySettings.EntityFormatRules.Last(fr => fr.IsApplyable(entityField)).Formatter(Html, entityField)
</td>
}
@foreach (var col in queryResult.Columns)
{
<td>
@formatters[col.Index](Html, row[col])
</td>
}
</tr>
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.
www.signumframework.com
I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...