public DataTablesGridColumnModel <T> Custom(string columnName, Func <T, object> customRenderer) { var column = new DataTablesGridColumnModel <T> { Evaluator = customRenderer, ColumnName = columnName, Header = columnName }; m_Columns.Add(column); return(column); }
public DataTablesGridColumnModel <T> For(Expression <Func <T, object> > propertySpecifier, string valueFormat = null) { var column = new DataTablesGridColumnModel <T> { Evaluator = propertySpecifier.Compile(), ColumnName = (propertySpecifier.Body as MemberExpression).Member.Name, Header = (propertySpecifier.Body as MemberExpression).Member.Name, EncodeValue = true, ValueFormat = valueFormat }; m_Columns.Add(column); return(column); }
public static DataTablesGridColumnModel <T> Options <T>(this DataTablesGridColumnModel <T> model, bool?canFilter = null, bool?canSort = null, string columnName = null, bool?encodeValue = null, string header = null, string valueFormat = null, string filterTitle = null, bool?defaultSortAscending = null) where T : class { if (canFilter.HasValue) { model.CanFilter = canFilter.Value; } if (canSort.HasValue) { model.CanSort = canSort.Value; } if (columnName != null) { model.ColumnName = columnName; } if (encodeValue.HasValue) { model.EncodeValue = encodeValue.Value; } if (header != null) { model.Header = header; } if (valueFormat != null) { model.ValueFormat = valueFormat; } if (filterTitle != null) { model.FilterTitle = filterTitle; } if (defaultSortAscending != null) { model.DefaultSortAscending = defaultSortAscending.Value; } return(model); }