diff --git a/Build/CommonAssemblyInfo.cs b/Build/CommonAssemblyInfo.cs index 9a500bd..daf7530 100644 --- a/Build/CommonAssemblyInfo.cs +++ b/Build/CommonAssemblyInfo.cs @@ -15,6 +15,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.5.0")] -[assembly: AssemblyFileVersion("2.5.0")] +[assembly: AssemblyVersion("2.5.1")] +[assembly: AssemblyFileVersion("2.5.1")] //[assembly: AssemblyInformationalVersion("2.5-filters")] diff --git a/Griddly.Mvc/GriddlyFilter.cs b/Griddly.Mvc/GriddlyFilter.cs index 51889a8..77838f7 100644 --- a/Griddly.Mvc/GriddlyFilter.cs +++ b/Griddly.Mvc/GriddlyFilter.cs @@ -40,6 +40,8 @@ public string Caption public string HtmlClass { get; set; } + public string Group { get; set; } + public string Field { get; set; } public virtual FilterDataType DataType { get; set; } diff --git a/Griddly.Mvc/GriddlyFilterBarSettings.cs b/Griddly.Mvc/GriddlyFilterBarSettings.cs index b10fb89..8afa83d 100644 --- a/Griddly.Mvc/GriddlyFilterBarSettings.cs +++ b/Griddly.Mvc/GriddlyFilterBarSettings.cs @@ -19,36 +19,36 @@ public GriddlyFilterBarSettings() public List Filters { get; set; } - public GriddlyFilterBarSettings FilterBox(string field, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null) + public GriddlyFilterBarSettings FilterBox(string field, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null, string group = null) { - return Add(GriddlyFilterExtensions.FilterBox(null, dataType, field, caption, htmlClass, captionPlural)); + return Add(GriddlyFilterExtensions.FilterBox(null, dataType, field, caption, htmlClass, captionPlural, group)); } - public GriddlyFilterBarSettings FilterRange(string field, string fieldEnd, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null) + public GriddlyFilterBarSettings FilterRange(string field, string fieldEnd, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null, string group = null) { - return Add(GriddlyFilterExtensions.FilterRange(null, dataType, field, fieldEnd, caption, htmlClass, captionPlural)); + return Add(GriddlyFilterExtensions.FilterRange(null, dataType, field, fieldEnd, caption, htmlClass, captionPlural, group)); } - public GriddlyFilterBarSettings FilterList(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public GriddlyFilterBarSettings FilterList(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) { - return Add(GriddlyFilterExtensions.FilterList(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterList(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } - public GriddlyFilterBarSettings FilterEnum(string field, string caption, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public GriddlyFilterBarSettings FilterEnum(string field, string caption, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) where T : struct { - return Add(GriddlyFilterExtensions.FilterEnum(null, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterEnum(null, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } - public GriddlyFilterBarSettings FilterEnum(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public GriddlyFilterBarSettings FilterEnum(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) where T : struct { - return Add(GriddlyFilterExtensions.FilterEnum(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterEnum(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } - public GriddlyFilterBarSettings FilterBool(string field, string caption, string trueLabel = "Yes", string falseLabel = "No", string nullItemText = null, bool isMultiple = false, bool defaultSelectAll = false, bool isNoneAll = false, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = true) + public GriddlyFilterBarSettings FilterBool(string field, string caption, string trueLabel = "Yes", string falseLabel = "No", string nullItemText = null, bool isMultiple = false, bool defaultSelectAll = false, bool isNoneAll = false, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = true, string group = null) { - return Add(GriddlyFilterExtensions.FilterBool(null, trueLabel, falseLabel, nullItemText, isMultiple, defaultSelectAll, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterBool(null, trueLabel, falseLabel, nullItemText, isMultiple, defaultSelectAll, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } public GriddlyFilterBarSettings Add(GriddlyFilter filter) diff --git a/Griddly.Mvc/GriddlyFilterExtensions.cs b/Griddly.Mvc/GriddlyFilterExtensions.cs index 63b7616..26a3834 100644 --- a/Griddly.Mvc/GriddlyFilterExtensions.cs +++ b/Griddly.Mvc/GriddlyFilterExtensions.cs @@ -10,7 +10,7 @@ public static class GriddlyFilterExtensions // ******** // NOTE: these methods can be called with null column by the ones on GriddlySettings // ******** - public static GriddlyFilterBox FilterBox(this GriddlyColumn column, FilterDataType dataType = FilterDataType.Decimal, string field = null, string caption = null, string htmlClass = null, string captionPlural = null) + public static GriddlyFilterBox FilterBox(this GriddlyColumn column, FilterDataType dataType = FilterDataType.Decimal, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, string group = null) { if (caption == null) caption = column.Caption; @@ -28,7 +28,8 @@ public static GriddlyFilterBox FilterBox(this GriddlyColumn column, FilterDataTy Field = field, Caption = caption, DataType = dataType, - HtmlClass = htmlClass + HtmlClass = htmlClass, + Group = group }; if (captionPlural != null) @@ -37,7 +38,7 @@ public static GriddlyFilterBox FilterBox(this GriddlyColumn column, FilterDataTy return filter; } - public static GriddlyFilterRange FilterRange(this GriddlyColumn column, FilterDataType dataType = FilterDataType.Decimal, string field = null, string fieldEnd = null, string caption = null, string htmlClass = null, string captionPlural = null) + public static GriddlyFilterRange FilterRange(this GriddlyColumn column, FilterDataType dataType = FilterDataType.Decimal, string field = null, string fieldEnd = null, string caption = null, string htmlClass = null, string captionPlural = null, string group = null) { if (caption == null) caption = column.Caption; @@ -60,7 +61,8 @@ public static GriddlyFilterRange FilterRange(this GriddlyColumn column, FilterDa FieldEnd = fieldEnd, Caption = caption, DataType = dataType, - HtmlClass = htmlClass + HtmlClass = htmlClass, + Group = group }; if (captionPlural != null) @@ -69,7 +71,7 @@ public static GriddlyFilterRange FilterRange(this GriddlyColumn column, FilterDa return filter; } - public static GriddlyFilterList FilterList(this GriddlyColumn column, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public static GriddlyFilterList FilterList(this GriddlyColumn column, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) { if (caption == null) caption = column.Caption; @@ -105,7 +107,8 @@ public static GriddlyFilterList FilterList(this GriddlyColumn column, IEnumerabl IsNullable = !string.IsNullOrWhiteSpace(nullItemText), DefaultSelectAll = defaultSelectAll, HtmlClass = htmlClass, - DisplayIncludeCaption = displayIncludeCaption + DisplayIncludeCaption = displayIncludeCaption, + Group = group }; if (captionPlural != null) @@ -129,21 +132,21 @@ public static string GetField(GriddlyColumn column) return value; } - public static GriddlyFilterList FilterEnum(this GriddlyColumn column, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public static GriddlyFilterList FilterEnum(this GriddlyColumn column, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) where T : struct { - return column.FilterList(Extensions.ToSelectListItems().OrderBy(x => x.Text), isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption); + return column.FilterList(Extensions.ToSelectListItems().OrderBy(x => x.Text), isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group); } - public static GriddlyFilterList FilterEnum(this GriddlyColumn column, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public static GriddlyFilterList FilterEnum(this GriddlyColumn column, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) where T : struct { - return column.FilterList(Extensions.ToSelectListItems(items).OrderBy(x => x.Text), isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption); + return column.FilterList(Extensions.ToSelectListItems(items).OrderBy(x => x.Text), isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group); } - public static GriddlyFilterList FilterBool(this GriddlyColumn column, string trueLabel = "Yes", string falseLabel = "No", string nullItemText = null, bool isMultiple = false, bool defaultSelectAll = false, bool isNoneAll = false, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = true) + public static GriddlyFilterList FilterBool(this GriddlyColumn column, string trueLabel = "Yes", string falseLabel = "No", string nullItemText = null, bool isMultiple = false, bool defaultSelectAll = false, bool isNoneAll = false, string field = null, string caption = null, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = true, string group = null) { - return column.FilterList(BuildBoolItems(trueLabel, falseLabel), isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption); + return column.FilterList(BuildBoolItems(trueLabel, falseLabel), isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group); } static List BuildBoolItems(string trueLabel, string falseLabel) diff --git a/Griddly.Mvc/GriddlySettings.cs b/Griddly.Mvc/GriddlySettings.cs index bf0a14a..a2a115a 100644 --- a/Griddly.Mvc/GriddlySettings.cs +++ b/Griddly.Mvc/GriddlySettings.cs @@ -197,36 +197,36 @@ public GriddlySettings Add(GriddlyExport export) return this; } - public GriddlySettings FilterBox(string field, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null) + public GriddlySettings FilterBox(string field, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null, string group = null) { - return Add(GriddlyFilterExtensions.FilterBox(null, dataType, field, caption, htmlClass, captionPlural)); + return Add(GriddlyFilterExtensions.FilterBox(null, dataType, field, caption, htmlClass, captionPlural, group)); } - public GriddlySettings FilterRange(string field, string fieldEnd, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null) + public GriddlySettings FilterRange(string field, string fieldEnd, string caption, FilterDataType dataType = FilterDataType.Decimal, string htmlClass = null, string captionPlural = null, string group = null) { - return Add(GriddlyFilterExtensions.FilterRange(null, dataType, field, fieldEnd, caption, htmlClass, captionPlural)); + return Add(GriddlyFilterExtensions.FilterRange(null, dataType, field, fieldEnd, caption, htmlClass, captionPlural, group)); } - public GriddlySettings FilterList(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public GriddlySettings FilterList(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) { - return Add(GriddlyFilterExtensions.FilterList(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterList(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } - public GriddlySettings FilterEnum(string field, string caption, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public GriddlySettings FilterEnum(string field, string caption, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) where T : struct { - return Add(GriddlyFilterExtensions.FilterEnum(null, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterEnum(null, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } - public GriddlySettings FilterEnum(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false) + public GriddlySettings FilterEnum(string field, string caption, IEnumerable items, bool isMultiple = true, bool defaultSelectAll = false, string nullItemText = null, bool isNoneAll = true, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = false, string group = null) where T : struct { - return Add(GriddlyFilterExtensions.FilterEnum(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterEnum(null, items, isMultiple, defaultSelectAll, nullItemText, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } - public GriddlySettings FilterBool(string field, string caption, string trueLabel = "Yes", string falseLabel = "No", string nullItemText = null, bool isMultiple = false, bool defaultSelectAll = false, bool isNoneAll = false, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = true) + public GriddlySettings FilterBool(string field, string caption, string trueLabel = "Yes", string falseLabel = "No", string nullItemText = null, bool isMultiple = false, bool defaultSelectAll = false, bool isNoneAll = false, string htmlClass = null, string captionPlural = null, bool displayIncludeCaption = true, string group = null) { - return Add(GriddlyFilterExtensions.FilterBool(null, trueLabel, falseLabel, nullItemText, isMultiple, defaultSelectAll, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption)); + return Add(GriddlyFilterExtensions.FilterBool(null, trueLabel, falseLabel, nullItemText, isMultiple, defaultSelectAll, isNoneAll, field, caption, htmlClass, captionPlural, displayIncludeCaption, group)); } public GriddlySettings Add(GriddlyFilter filter) diff --git a/Griddly/Views/Home/FilterBar.cshtml b/Griddly/Views/Home/FilterBar.cshtml index 9bb8189..7c75307 100644 --- a/Griddly/Views/Home/FilterBar.cshtml +++ b/Griddly/Views/Home/FilterBar.cshtml @@ -6,8 +6,10 @@ { } - .FilterBox("test", "Da Test", FilterDataType.String) - .FilterBool("bar", "Da Bar", nullItemText: "Both") + .FilterBox("test", "Availability", FilterDataType.String, group: "Properties") + .FilterRange("guestsStart", "guestsEnd", "Guests", group: "Properties") + .FilterBool("bar", "Payment Status", nullItemText: "Both", group: "Bookings") + .FilterBool("test", "Listing Site", group: "Bookings") ; } diff --git a/Griddly/Views/Shared/Griddly/GriddlyFilterForm.cshtml b/Griddly/Views/Shared/Griddly/GriddlyFilterForm.cshtml index 817e8f6..f3abece 100644 --- a/Griddly/Views/Shared/Griddly/GriddlyFilterForm.cshtml +++ b/Griddly/Views/Shared/Griddly/GriddlyFilterForm.cshtml @@ -11,138 +11,152 @@ @model List -@foreach (GriddlyFilter filter in Model) +@{ + bool isFirstGroup = true; +} + +@foreach (var filterGroup in Model.GroupBy(x => x.Group).OrderBy(x => x.Key)) { - GriddlyFilterBox filterBox = filter as GriddlyFilterBox; - GriddlyFilterRange filterRange = filter as GriddlyFilterRange; - GriddlyFilterList filterList = filter as GriddlyFilterList; - GriddlyHtmlFilter filterHtml = filter as GriddlyHtmlFilter; + if (!string.IsNullOrWhiteSpace(filterGroup.Key)) + { + + } + + isFirstGroup = false; - object defaultValue = this.GetGriddlyDefault(filter.Field); - object defaultValueEnd = filterRange != null ? this.GetGriddlyDefault(filterRange.FieldEnd) : null; + foreach (var filter in filterGroup) + { + GriddlyFilterBox filterBox = filter as GriddlyFilterBox; + GriddlyFilterRange filterRange = filter as GriddlyFilterRange; + GriddlyFilterList filterList = filter as GriddlyFilterList; + GriddlyHtmlFilter filterHtml = filter as GriddlyHtmlFilter; -
filterRange.FieldEnd) - data-filter-datatype="@filter.DataType.ToString()" - @Html.AttributeIf("data-griddly-filter-ismultiple", filterList != null, x => filterList.IsMultiple.ToString().ToLower()) - @Html.AttributeIf("data-griddly-filter-isnoneall", filterList != null, x => filterList.IsNoneAll.ToString().ToLower()) - @Html.AttributeIf("data-griddly-filter-isnullable", filterList != null, x => filterList.IsNullable.ToString().ToLower()) - @Html.AttributeIf("data-griddly-filter-displayitemcount", filterList != null, x => filterList.DisplayItemCount) - @Html.AttributeIf("data-griddly-filter-displayincludecaption", filterList != null, x => filterList.DisplayIncludeCaption.ToString().ToLower())> - -
- @if (filterBox != null) - { - if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) + object defaultValue = this.GetGriddlyDefault(filter.Field); + object defaultValueEnd = filterRange != null ? this.GetGriddlyDefault(filterRange.FieldEnd) : null; + +
filterRange.FieldEnd) + data-filter-datatype="@filter.DataType.ToString()" + @Html.AttributeIf("data-griddly-filter-ismultiple", filterList != null, x => filterList.IsMultiple.ToString().ToLower()) + @Html.AttributeIf("data-griddly-filter-isnoneall", filterList != null, x => filterList.IsNoneAll.ToString().ToLower()) + @Html.AttributeIf("data-griddly-filter-isnullable", filterList != null, x => filterList.IsNullable.ToString().ToLower()) + @Html.AttributeIf("data-griddly-filter-displayitemcount", filterList != null, x => filterList.DisplayItemCount) + @Html.AttributeIf("data-griddly-filter-displayincludecaption", filterList != null, x => filterList.DisplayIncludeCaption.ToString().ToLower())> + +
+ @if (filterBox != null) { - @:
- if (filter.DataType == FilterDataType.Currency) + if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) { - @Griddly.Mvc.GriddlyExtensions.CurrencySymbol + @:
+ if (filter.DataType == FilterDataType.Currency) + { + @Griddly.Mvc.GriddlyExtensions.CurrencySymbol + } + else if (filter.DataType == FilterDataType.Date) + { + + } } - else if (filter.DataType == FilterDataType.Date) + + if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) { - + @*@if (filter.DataType == FilterDataType.Percent) + { + % + }*@ + @:
} } - - if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) + else if (filterRange != null) { - @*@if (filter.DataType == FilterDataType.Percent) - { - % - }*@ - @:
- } - } - else if (filterRange != null) - { -
-
- @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) - { - @:
- if (filter.DataType == FilterDataType.Currency) +
+
+ @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) { - @Griddly.Mvc.GriddlyExtensions.CurrencySymbol + @:
+ if (filter.DataType == FilterDataType.Currency) + { + @Griddly.Mvc.GriddlyExtensions.CurrencySymbol + } + else if (filter.DataType == FilterDataType.Date) + { + + } } - else if (filter.DataType == FilterDataType.Date) + + @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) { - + @*@if (filter.DataType == FilterDataType.Percent) + { + % + }*@ + @:
} - } - - @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) - { - @*@if (filter.DataType == FilterDataType.Percent) - { - % - }*@ - @:
- } -
-
to
-
- @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) - { - @:
- if (filter.DataType == FilterDataType.Currency) +
+
to
+
+ @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) { - @Griddly.Mvc.GriddlyExtensions.CurrencySymbol + @:
+ if (filter.DataType == FilterDataType.Currency) + { + @Griddly.Mvc.GriddlyExtensions.CurrencySymbol + } + else if (filter.DataType == FilterDataType.Date) + { + + } } - else if (filter.DataType == FilterDataType.Date) + + @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) { - + @*@if (filter.DataType == FilterDataType.Percent) + { + % + }*@ + @:
} - } - - @if (filter.DataType == FilterDataType.Currency || filter.DataType == FilterDataType.Date) - { - @*@if (filter.DataType == FilterDataType.Percent) - { - % - }*@ - @:
- } +
-
- } - else if (filterList != null) - { - filterList.SetSelectedItems(defaultValue); - - + @foreach (SelectListItem item in filterList.Items) { - - @foreach (SelectListItem childItem in group.Items) - { - @RenderListItem(childItem) - } - - } - else - { - @RenderListItem(item) + SelectListItemGroup group = item as SelectListItemGroup; + + if (group != null) + { + + @foreach (SelectListItem childItem in group.Items) + { + @RenderListItem(childItem) + } + + } + else + { + @RenderListItem(item) + } } - } - - } - else if (filterHtml != null) - { - @filterHtml.HtmlTemplate(filter) - } + + } + else if (filterHtml != null) + { + @filterHtml.HtmlTemplate(filter) + } +
-
+ } } @helper RenderListItem(SelectListItem item)