/// <summary> /// Executes a delegate that can be used to specify custom HTML to replace the built in rendering of the start of the row. /// </summary> /// <param name="grid">The grid</param> /// <param name="template">Razor template to use.</param> public static IGridWithOptions <T> RowStart <T>(this IGridWithOptions <T> grid, Func <T, object> template) where T : class { grid.Model.Sections.Row.StartSectionRenderer = (rowData, context) => { context.Writer.Write(template(rowData.Item)); return(true); }; return(grid); }
public static IGridWithOptions <T> AutoColumns <T>(this IGridWithOptions <T> grid) where T : class { var properySpecifiers = typeof(T).GetProperties() .Where(info => ShouldPropertyBeDisplayed(info)) .Select(info => ProperyToLamdaExpression <T>(info)).ToArray(); grid.Columns( builder => { properySpecifiers.ForEach(propertySpecifier => builder.For(propertySpecifier)); }); return(grid); }
public static IGridWithOptions <T> RowAlternateColor <T>(this IGridWithOptions <T> grid) where T : class { grid.Model.Sections.RowStart(a => (a.IsAlternate) ? "<tr class='tr-alt-item'>" : "<tr>"); return(grid); }
public static IGridWithOptions <T> WithClass <T>(this IGridWithOptions <T> grid, string htmlID) where T : class { return(grid.Attributes(@class => htmlID)); }
public static IGridWithOptions <T> RowEnd <T>(this IGridWithOptions <T> grid, Action <T> block) where T : class { grid.Model.Sections.RowEnd(block); return(grid); }
public static IGridWithOptions <T> RowStart <T>(this IGridWithOptions <T> grid, Action <T, GridRowViewData <T> > block) where T : class { grid.Model.Sections.RowStart(block); return(grid); }
/// <summary> /// Defines additional attributes for a grid. /// </summary> /// <returns></returns> public static IGridWithOptions <T> Attributes <T>(this IGridWithOptions <T> grid, params Func <object, object>[] hash) where T : class { return(grid.Attributes(new Hash(hash))); }
/// <summary> /// Renders the specified text at the start of every row instead of the default output. /// </summary> /// <param name="grid">The grid</param> /// <param name="rowEnd">Lambda takes an instance of GridRowViewData and returns the string to render</param> /// <returns></returns> public static IGridWithOptions <T> RowEnd <T>(this IGridWithOptions <T> grid, Func <GridRowViewData <T>, string> rowEnd) where T : class { grid.Model.Sections.RowEnd(rowEnd); return(grid); }