Permalink
Browse files

option to add a css class to a quick filter, e.g. something like visi…

…ble-lg to make it visible only on large devices
  • Loading branch information...
1 parent 463b1a7 commit c17a500c77e5a7001f7644bc77051735ee38552e @volkanceylan committed Dec 28, 2016
@@ -11,5 +11,6 @@ public QuickFilterAttribute(bool value = true)
public bool Value { get; private set; }
public bool Separator { get; set; }
+ public string CssClass { get; set; }
}
}
@@ -104,6 +104,8 @@ public class PropertyItem
public Dictionary<string, object> QuickFilterParams { get; set; }
[JsonProperty("quickFilterSeparator")]
public bool QuickFilterSeparator { get; set; }
+ [JsonProperty("quickFilterCssClass")]
+ public string QuickFilterCssClass { get; set; }
public bool ShouldSerializeEditorType()
{
@@ -23,11 +23,15 @@ private static void SetFiltering(IPropertySource source, PropertyItem item)
return;
var quickFilterAttr = source.GetAttribute<QuickFilterAttribute>();
- if (quickFilterAttr != null && quickFilterAttr.Value)
+ if (quickFilterAttr != null)
+ {
item.QuickFilter = true;
+ if (quickFilterAttr.Separator)
+ item.QuickFilterSeparator = true;
- if (quickFilterAttr != null && quickFilterAttr.Separator)
- item.QuickFilterSeparator = true;
+ if (!string.IsNullOrEmpty(quickFilterAttr.CssClass))
+ item.QuickFilterCssClass = quickFilterAttr.CssClass;
+ }
var basedOnField = source.BasedOnField;
if (!ReferenceEquals(null, basedOnField) &&
@@ -58,5 +58,6 @@ public class PropertyItem
public bool? QuickFilter { get; set; }
public JsDictionary QuickFilterParams { get; set; }
public bool? QuickFilterSeparator { get; set; }
+ public string QuickFilterCssClass { get; set; }
}
}
@@ -177,9 +177,12 @@ protected virtual void CreateQuickFilters()
else
continue;
}
+
if (item.QuickFilterSeparator == true)
quick.Seperator = true;
+ quick.CssClass = item.QuickFilterCssClass;
+
list.Add(quick);
}
@@ -1051,6 +1054,9 @@ protected string DetermineText(Func<string, string> getKey)
.Children().Text(opt.Title ?? DetermineText(pre => pre + opt.Field) ?? opt.Field)
.Parent();
+ if (!string.IsNullOrEmpty(opt.CssClass))
+ quickFilter.AddClass(opt.CssClass);
+
var widget = Widget.CreateOfType(opt.Type, e =>
{
if (!opt.Field.IsEmptyOrNull())
@@ -19,5 +19,6 @@ public class QuickFilter<TWidget, TOptions>
public Action<TWidget> Init { get; set; }
public Action<QuickFilterArgs<TWidget>> Handler { get; set; }
public bool Seperator { get; set; }
+ public string CssClass { get; set; }
}
}
@@ -9,5 +9,6 @@
element?: (e: JQuery) => void;
init?: (w: TWidget) => void;
separator?: boolean;
+ cssClass?: string;
}
}
@@ -1386,6 +1386,7 @@ declare namespace Serenity {
element?: (e: JQuery) => void;
init?: (w: TWidget) => void;
separator?: boolean;
+ cssClass?: string;
}
}
declare namespace Serenity {

0 comments on commit c17a500

Please sign in to comment.