public static IColumnConfigurator <T, TLink, TFilter> Header <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c, object caption) where T : class, IEntity, new() where TFilter : IFilter <TLink> { if (caption is string s) { caption = c.Localize(s); } c.Column.Header = caption; return(c); }
public static IColumnConfigurator <T, int?, EntityFilterNullable <TE> > Column <T, TLink, TFilter, TE>(this IColumnConfigurator <T, TLink, TFilter> c, Expression <Func <T, TE> > getter, string id = null, // Expression<Func<T, int?>> getterId = null, double width = double.NaN ) where T : class, IEntity, new() where TFilter : IFilter <TLink> where TE : class, IListableModel, IEntity <int>, new() { var lambda = getter.Compile(); // getterId ??= GetterIdNullableFromGetter(getter); return(c.Column(id) .Header($"{{{typeof(TE).Name}}}") .Width(width) .LinkNullable(getter) .Content(e => lambda(e)) .OrderBy(e => c.Localize(lambda(e)?.Caption)) // TODO .Icon(e => lambda(e)?.IconPath) .Filter().IconPath($"Icons/Entities/{typeof(TE).Name}") ); }