/// <summary> /// Adds client total calculator that produces count of rows /// </summary> /// <param name="conf">Configuration</param> /// <param name="column">Table column to provide total with</param> /// <param name="clientDataSet">Client data set to perform calculations on</param> /// <param name="template">Tempalte for total cell</param> /// <returns></returns> public static TotalCalculatorBuilder <TSourceData, TTableData> AddClientCount <TSourceData, TTableData, TTableColumn>( this TotalCalculatorBuilder <TSourceData, TTableData> conf, Expression <Func <TTableData, TTableColumn> > column, ClientDataSet clientDataSet, Action <CellTemplateBuilder> template = null ) where TTableData : new() { var name = LambdaHelpers.ParsePropertyLambda(column).Name; var function = string.Format("function(v){{ return v.{0}.length; }}", clientDataSet); conf.ClientCalculators.Add(name, function); if (template != null) { conf.AddTemplate(column, template); } return(conf); }
/// <summary> /// Adds client total calculator that produces maximum of supplied row values /// </summary> /// <param name="conf">Configuration</param> /// <param name="column">Table column to provide total with</param> /// <param name="expression">`{@}`-syntax expression minimum of which will be found</param> /// <param name="clientDataSet">Client data set to perform calculations on</param> /// <param name="template">Tempalte for total cell</param> /// <returns></returns> public static TotalCalculatorBuilder <TSourceData, TTableData> AddClientMax <TSourceData, TTableData, TTableColumn>( this TotalCalculatorBuilder <TSourceData, TTableData> conf, Expression <Func <TTableData, TTableColumn> > column, string expression, ClientDataSet clientDataSet, Action <CellTemplateBuilder> template = null ) where TTableData : new() { var name = LambdaHelpers.ParsePropertyLambda(column).Name; var function = CreateExtremumFunction(expression, true, clientDataSet); conf.ClientCalculators.Add(name, function); if (template != null) { conf.AddTemplate(column, template); } return(conf); }