protected GridColumnBase(Grid <T> grid) { Grid = grid; Settings = new GridColumnSettings(); Visible = true; HeaderTemplate = new HtmlTemplate(); FooterTemplate = new HtmlTemplate <GridAggregateResult>(); }
public GridColumnBase <T> CreateColumn(GridColumnSettings settings) { var commandSettings = settings as GridCommandColumnSettings; if (commandSettings != null) { var column = new GridActionColumn <T>(grid); column.Settings = settings; foreach (var command in commandSettings.Commands) { if (!(command is GridSelectActionCommand)) { grid.Editing.Enabled = true; } column.Commands.Add(command); } return(column); } return(CreateBoundColumn(settings)); }
private GridColumnBase <T> CreateBoundColumn(GridColumnSettings settings) { var memberType = settings.MemberType; var lambdaExpression = ExpressionBuilder.Lambda <T>(memberType, settings.Member, false); var columnType = typeof(GridBoundColumn <,>).MakeGenericType(new[] { typeof(T), lambdaExpression.Body.Type }); var constructor = columnType.GetConstructor(new[] { grid.GetType(), lambdaExpression.GetType() }); var column = (GridColumnBase <T>)constructor.Invoke(new object[] { grid, lambdaExpression }); if (memberType != null) { (column as IGridBoundColumn).MemberType = memberType; } column.Settings = settings; if (settings is GridColumnSettings <T> ) { column.Template = ((GridColumnSettings <T>)settings).Template; } return(column); }