/// <exclude/> public TableBuilderT(string id = null, string url = null, TablePaginationOption sidePagination = TablePaginationOption.None, object htmlAttributes = null) : base(id, url, sidePagination, htmlAttributes) { typeof(TModel).GetSortedProperties().ToDictionary(x => x.Name, x => x).ForEach(pair => { var display = pair.Value.GetCustomAttribute <DisplayAttribute>(); var hidden = pair.Value.GetCustomAttribute <HiddenInputAttribute>(); if (hidden != null && hidden.DisplayValue != true) { return; } if (display != null && display.GetAutoGenerateField() != null && !display.AutoGenerateField) { return; } if (display != null && !string.IsNullOrEmpty(display.GetName())) { Column(display.GetName(), pair.Key); } else { Column(pair.Key.SplitCamelCase(), pair.Key); } }); }
/// <inheritDoc/> public TableBuilder(string id = null, string url = null, TablePaginationOption? sidePagination = TablePaginationOption.none, object htmlAttributes = null) { _builder = new TagBuilder("table"); if (!string.IsNullOrEmpty(id)) _builder.Attributes.Add("id", id); if (sidePagination != TablePaginationOption.none) { Apply(TableOption.pagination); ApplyToTable(sidePagination.FieldName(), sidePagination.FieldValue()); } if (!string.IsNullOrEmpty(url)) Apply(TableOption.url, url); _builder.MergeAttributes(htmlAttributes.HtmlAttributesToDictionary()); Apply(TableOption.toggle); }
/// <summary> /// Returns a BootstrapTable control. /// </summary> /// <typeparam name="TModel">Model</typeparam> /// <param name="helper">The HTML helper instance that this method extends.</param> /// <param name="id">Identity of the control.</param> /// <param name="url">The url that will be used to obtain the data.</param> /// <param name="pagination">Is pagination required.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <returns>Html representation of the control.</returns> public static ITableBuilderT <TModel> BootstrapTable <TModel>(this HtmlHelper helper, string id, string url, TablePaginationOption pagination = TablePaginationOption.none, object htmlAttributes = null) { return(new TableBuilderT <TModel>(id, url, pagination, htmlAttributes)); }
/// <exclude/> public TableBuilderT(string id = null, GridTreeDataModel model = null, string url = null, TablePaginationOption sidePagination = TablePaginationOption.none, object htmlAttributes = null) : base(id, model, url, sidePagination, htmlAttributes) { typeof(TModel).GetSortedProperties().ToDictionary(x => x.Name, x => x).ForEach(pair => { DisplayAttribute display = pair.Value.GetCustomAttribute <DisplayAttribute>(); HiddenInputAttribute hidden = pair.Value.GetCustomAttribute <HiddenInputAttribute>(); if (hidden == null || hidden.DisplayValue == true) { if (display == null || display.GetAutoGenerateField() == null || display.AutoGenerateField == true) { if (display != null && !string.IsNullOrEmpty(display.GetName())) { Column(display.GetName(), pair.Key); } else { Column(pair.Key.SplitCamelCase(), pair.Key); } } } }); }
/// <summary> /// Returns a BootstrapTable control. /// </summary> /// <param name="helper">The HTML helper instance that this method extends.</param> /// <param name="url">The url that will be used to obtain the data.</param> /// <param name="pagination">Is pagination required.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <returns>Html representation of the control.</returns> public static ITableBuilder BootstrapTable(this HtmlHelper helper, string url = null, TablePaginationOption pagination = TablePaginationOption.None, object htmlAttributes = null) { return(new TableBuilder(null, url, pagination, htmlAttributes)); }
/// <summary> /// Returns a BootstrapTable control. /// </summary> /// <typeparam name="TModel">Model</typeparam> /// <param name="helper">The HTML helper instance that this method extends.</param> /// <param name="id">Identity of the control.</param> /// <param name="url">The url that will be used to obtain the data.</param> /// <param name="pagination">Is pagination required.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <returns>Html representation of the control.</returns> public static ITableBuilderT <TModel> BootstrapTable <TModel>(this HtmlHelper helper, string id, GridTreeDataModel model, string url, TablePaginationOption pagination = TablePaginationOption.none, object htmlAttributes = null) { var obj = new TableBuilderT <TModel>(id, model, url, pagination, htmlAttributes); return(obj); }