Ejemplo n.º 1
0
        /// <inheritDoc/>
        public TableBuilder(string id = null, GridTreeDataModel model = null, string url = null, TablePaginationOption?sidePagination = TablePaginationOption.none, object htmlAttributes = null)
        {
            if (model != null)
            {
                LoadToobarButtonEvent += () => model.Authoritys.ToString();
            }
            _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);
        }
Ejemplo n.º 2
0
        public TreeGridBuilder(GridTreeDataModel model, string id = null, string tableClass = null, object htmlAttributes = null)
        {
            authStrhtml    = model.Authoritys.ToString();
            this.listDatas = model.TreeModels;
            builder        = new TagBuilder("table");
            string className = "table";

            if (id != null)
            {
                builder.Attributes.Add("id", id);
            }
            if (tableClass != null)
            {
                className += (" " + tableClass.Trim());
            }
            builder.Attributes.Add("class", className);

            builder.MergeAttributes(htmlAttributes as IDictionary <string, object> ?? HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));

            builder.InnerHtml += ApplyTrColumnHtml(LoadThead, null);
            ApplyDataCoumn();
        }
Ejemplo n.º 3
0
        /// <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);
                        }
                    }
                }
            });
        }
Ejemplo n.º 4
0
        public static TreeGridBuilder <TModel> TreeGrid <TModel>(this HtmlHelper helper, GridTreeDataModel model, string id, string className, object htmlAttributes = null)
        {
            var obj = new TreeGridBuilder <TModel> (model, id, className, htmlAttributes);

            return(obj);
        }
Ejemplo n.º 5
0
        /// <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);
        }