/// <summary> /// Sets query confirmation function that is being called every time befor query is performed to bring /// ability to handle heavy queries /// </summary> public static Configurator <TSourceData, TTableData> QueryConfirmation <TSourceData, TTableData> (this Configurator <TSourceData, TTableData> conf, string confirmationFunction) where TTableData : new() { conf.TableConfiguration.QueryConfirmation = string.IsNullOrEmpty(confirmationFunction) ? null : new JRaw(confirmationFunction); return(conf); }
/// <summary> /// Disables or enables immediate fetching of table data from server /// </summary> /// <param name="c">Table configurator</param> /// <param name="load">Load (or not)</param> /// <returns>Fluent</returns> public static Configurator <TSourceData, TTableData> LoadImmediately <TSourceData, TTableData>(this Configurator <TSourceData, TTableData> c, bool load) where TTableData : new() { c.TableConfiguration.LoadImmediately = load; return(c); }
/// <summary> /// Function that should consume IRow instance and return template name for this particular row. /// Return null/empty/undefined will let system to choose default template. /// You can access row data via .DataObject property /// </summary> public static Configurator <TSourceData, TTableData> RowTemplateSelector <TSourceData, TTableData> (this Configurator <TSourceData, TTableData> conf, string selectorFunction) where TTableData : new() { conf.TableConfiguration.TemplateSelector = string.IsNullOrEmpty(selectorFunction) ? null : new JRaw(selectorFunction); return(conf); }
/// <summary> /// Function that should consume ITableMessage instance (similar to server's one) and show table message /// </summary> public static Configurator <TSourceData, TTableData> ShowMessagesWith <TSourceData, TTableData> (this Configurator <TSourceData, TTableData> conf, string messageFunction) where TTableData : new() { conf.TableConfiguration.MessageFunction = string.IsNullOrEmpty(messageFunction) ? null : new JRaw(messageFunction); return(conf); }
/// <summary> /// Overrides core table template IDs /// </summary> /// <param name="t">Configurator</param> /// <param name="layout">TemplateID for table layout</param> /// <param name="pluginWrapper">TemplateID for plugin wrapper</param> /// <param name="rowWrapper">TemplateID for row wrapper</param> /// <param name="headerWrapper">TemplateID for header wrapper</param> /// <param name="cellWrapper">TemplateID for cell wrapper</param> /// <param name="messages">Template ID for messages wrappers</param> /// <returns></returns> public static Configurator <TSourceData, TTableData> CoreTemplates <TSourceData, TTableData>(this Configurator <TSourceData, TTableData> t, string layout = "layout", string pluginWrapper = "pluginWrapper", string rowWrapper = "rowWrapper", string headerWrapper = "headerWrapper", string cellWrapper = "cellWrapper", string messages = "messages" ) where TTableData : new() { t.TableConfiguration.CoreTemplates.Layout = layout; t.TableConfiguration.CoreTemplates.PluginWrapper = pluginWrapper; t.TableConfiguration.CoreTemplates.RowWrapper = rowWrapper; t.TableConfiguration.CoreTemplates.HeaderWrapper = headerWrapper; t.TableConfiguration.CoreTemplates.CellWrapper = cellWrapper; t.TableConfiguration.CoreTemplates.Messages = messages; return(t); }
/// <summary> /// Method to apply for converting TSourceData (source data records) to TTargetData (data records that should be displayed in table) /// </summary> /// <param name="c">Table configurator</param> /// <param name="projectionExpression">Function that will be applied to source set (filtered, ordered and cut) to get resulting set</param> /// <returns>Fluent</returns> public static Configurator <TSourceData, TTableData> ProjectDataWith <TSourceData, TTableData>(this Configurator <TSourceData, TTableData> c, Func <IQueryable <TSourceData>, IQueryable <TTableData> > projectionExpression) where TTableData : new() { c.Projection = projectionExpression; return(c); }
/// <summary> /// Sets up datepickers configuration for table. /// Since handling DateTime through JSON, JS/HTML and MVC is big problem then here /// we have this method which will allow you to specify custom JS function for constructing datepicker /// and also specifying client and server date formats. /// </summary> /// <param name="c">Table configurator</param> /// <param name="dpo">Datepicker options object</param> /// <returns></returns> public static Configurator <TSourceData, TTableData> DatePicker <TSourceData, TTableData>(this Configurator <TSourceData, TTableData> c, DatepickerOptions dpo) where TTableData : new() { c.TableConfiguration.DatepickerOptions = dpo; return(c); }
/// <summary> /// Sets main operational URL of whole table. /// Usually this URL should point to controller action that will return result of .HandleResponse/ await .HandleResponseAsync of table handler /// </summary> /// <param name="c">Table configurator</param> /// <param name="url">Server handling URL</param> /// <returns></returns> public static Configurator <TSourceData, TTableData> Url <TSourceData, TTableData>(this Configurator <TSourceData, TTableData> c, string url) where TTableData : new() { c.TableConfiguration.OperationalAjaxUrl = url; return(c); }
internal ColumnUsage(Configurator <TSourceData, TTableData> configurator, Expression <Func <TTableData, TTableColumn> > tableColumnExpression, ColumnConfiguration columnConfiguration) { _columnProperty = LambdaHelpers.ParsePropertyLambda(tableColumnExpression); _configurator = configurator; _columnConfiguration = columnConfiguration; }