38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using Kendo.Mvc.UI.Fluent;
|
|
|
|
namespace EnVisage.Code.Extensions
|
|
{
|
|
public static class KendoGridExtensions
|
|
{
|
|
public static GridBoundColumnBuilder<TModel> AddAggregateDateTemplates<TModel>(this GridBoundColumnBuilder<TModel> builder, string aggrMethod)
|
|
where TModel : class
|
|
{
|
|
const string templateFormat = "#= kendo.toString(kendo.parseDate({0}) || '', '{1}')#";
|
|
var template = string.Format(templateFormat, aggrMethod, builder.Column.Format);
|
|
|
|
return builder
|
|
.ClientFooterTemplate(template)
|
|
.ClientGroupFooterTemplate(template);
|
|
}
|
|
|
|
public static GridBoundColumnBuilder<TModel> ParseDate<TModel>(this GridBoundColumnBuilder<TModel> builder)
|
|
where TModel : class
|
|
{
|
|
const string templateFormat = "#= kendo.toString(kendo.parseDate({0}) || '', '{1}') #";
|
|
var template = string.Format(templateFormat, builder.Column.Member, builder.Column.Format);
|
|
|
|
return builder.ClientTemplate(template);
|
|
}
|
|
|
|
public static GridBoundColumnBuilder<TModel> AddCurrencySumTemplates<TModel>(this GridBoundColumnBuilder<TModel> builder)
|
|
where TModel : class
|
|
{
|
|
const string templateFormat = "#= kendo.format('{0}', sum) #";
|
|
var template = string.Format(templateFormat, builder.Column.Format);
|
|
|
|
return builder
|
|
.ClientFooterTemplate(template)
|
|
.ClientGroupFooterTemplate(template);
|
|
}
|
|
}
|
|
} |