Ejemplo n.º 1
0
        internal string GetWhereUrl(string fieldName)
        {
            var query = new Dictionary <string, StringValues>(Query);

            query.Remove(_pagerKeyword);
            query.Remove("s_" + fieldName);
            query.Remove("c_" + fieldName);
            query.Remove("ft_" + fieldName);
            var qs  = query.ToString();
            var op  = _dataAction.Contains("?") ? "&" : "?";
            var url = urlHelper.Content($@"~/{LibGeneral.GetContentUrl(_routeData)}/{_dataAction}{op}{qs}");

            return(url);
        }
Ejemplo n.º 2
0
        public string ActiveFilter(int colCount)
        {
            var qc = new List <KeyValuePair <string, string> >(_queryItems);

            foreach (var item in List)
            {
                qc.RemoveAll(d => d.Key == item.Key);
                qc.RemoveAll(d => d.Key == item.Key.Replace("s_", "c_"));
                qc.RemoveAll(d => d.Key == item.Key.Replace("s_", "ft_"));
            }
            var qb    = new QueryBuilder(qc);
            var param = qb.ToQueryString();

            var op = "";

            op += _dataAction.Contains("?") ? "&" : "?";
            var loader = $"javascript:{_jsFunction}('/{LibGeneral.GetContentUrl(_routeData)}/{_dataAction}{op}{param}','{_divGrid}');";

            loader = loader.Replace("??", "?");
            var builder = new StringBuilder();

            builder.AppendLine($"<tr colspan='{colCount.ToString(CultureInfo.InvariantCulture)}' class='filterRow'>");
            builder.AppendLine("<td>");

            builder.AppendLine(string.Format(@"<table width='100%'><tr>
                <td width='20px'><a href=""{0}""><img src='"
                                             + @"/Content/admin/plugins/MvcGrid/images/clear.png"
                                             + "' alt='" + Text.ClearFilter + "' /></a></td><td>" + Text.CurrentFilter, loader));
            var firstItem = true;

            foreach (var field in List)
            {
                if (!firstItem)
                {
                    builder.Append(", ");
                }

                builder.AppendLine(field.FilterDesc);
                firstItem = false;
            }
            builder.AppendLine("</td></tr></table>");
            builder.AppendLine("</td>");
            builder.AppendLine("</tr>");
            return(builder.ToString());
        }
Ejemplo n.º 3
0
        internal string GetWhereUrl(string fieldName)
        {
            var qc = new List <KeyValuePair <string, string> >(_queryItems);

            qc.RemoveAll(d => d.Key == _pagerKeyword);
            qc.RemoveAll(d => d.Key == "s_" + fieldName);
            qc.RemoveAll(d => d.Key == "c_" + fieldName);
            qc.RemoveAll(d => d.Key == "ft_" + fieldName);

            var qb = new QueryBuilder(qc);
            var qs = qb.ToQueryString();

            var op  = _dataAction.Contains("?") ? "&" : "?";
            var url = $@"/{LibGeneral.GetContentUrl(_routeData)}/{_dataAction}{op}{qs}";

            url = url.Replace("??", "?");
            return(url);
        }
Ejemplo n.º 4
0
        public string ActiveFilter(int colCount, List <DataColumn> fields)
        {
            var query = new Dictionary <string, StringValues>(Query);

            query.Remove(_pagerKeyword);
            foreach (var item in List)
            {
                query.Remove(item.Key);
                query.Remove(item.Key.Replace("s_", "c_"));
                query.Remove(item.Key.Replace("s_", "ft_"));
            }
            var param = query.ToString();
            var op    = "";

            op += _dataAction.Contains("?") ? "&" : "?";
            var loader  = $"javascript:{_jsFunction}('/{LibGeneral.GetContentUrl(_routeData)}/{_dataAction}{op}{param}','{_divGrid}');";
            var builder = new StringBuilder();

            builder.AppendLine($"<tr colspan='{colCount.ToString(CultureInfo.InvariantCulture)}' class='filterRow'>");
            builder.AppendLine("<td>");

            builder.AppendLine(string.Format(@"<table width='100%'><tr>
                <td width='20px'><a href=""{0}""><img src='"
                                             + urlHelper.Content(@"~/Content/admin/plugins/MvcGrid/images/clear.png")
                                             + "' alt='" + Text.ClearFilter + "' /></a></td><td>" + Text.CurrentFilter, loader));
            var firstItem = true;

            foreach (var field in List)
            {
                if (!firstItem)
                {
                    builder.Append(", ");
                }
                builder.AppendLine(field.FilterDesc);
                firstItem = false;
            }
            builder.AppendLine("</td></tr></table>");
            builder.AppendLine("</td>");
            builder.AppendLine("</tr>");
            return(builder.ToString());
        }
Ejemplo n.º 5
0
        private static string RenderPager <T>(IHtmlHelper helper, IEnumerable <T> items, DataGridOptions4 option, int currentPageSize,
                                              List <KeyValuePair <string, string> > queryItems)
            where T : class
        {
            var pagedList = (IPagedList <T>)items;

            if (pagedList != null)
            {
                var urlOperator = option.PagerAndShortAction.IndexOf("?") > -1 ? "&" : "?";
                var qc          = new List <KeyValuePair <string, string> >(queryItems);
                qc.RemoveAll(d => d.Key == option.PagerKeyword);
                qc.RemoveAll(d => d.Key == option.PageSizeKeyword);

                var qb         = new QueryBuilder(qc);
                var pageSizeQs = qb.ToQueryString();
                var pgeIndexli = pageSizeQs.ToUriComponent();

                var ci = option.PagerAndShortAction.Split('?');
                if (ci.Length > 1)
                {
                    pgeIndexli = pgeIndexli.Replace(ci[1], "");
                }
                if (pgeIndexli == "?")
                {
                    pgeIndexli = "";
                }
                if (pgeIndexli.Length > 1)
                {
                    pgeIndexli = "&" + pgeIndexli.Substring(1);
                }
                pgeIndexli = pgeIndexli.Replace("&&", "&");

                var pageUrl = string.Format(@"/{0}/{1}{6}{2}=[PAGE]&{4}={5}{3}",
                                            LibGeneral.GetContentUrl(helper.ViewContext.RouteData),
                                            option.PagerAndShortAction,
                                            option.PagerKeyword,
                                            pgeIndexli,
                                            option.PageSizeKeyword,
                                            currentPageSize,
                                            urlOperator).Replace("[PAGE]", "{0}");

                var fs = string.Format(@"/{0}/{1}{4}{2}&{3}=XXX",
                                       LibGeneral.GetContentUrl(helper.ViewContext.RouteData),
                                       option.PagerAndShortAction,
                                       pgeIndexli,
                                       option.PageSizeKeyword,
                                       urlOperator);
                fs = fs.Replace("?&", "?");
                fs = fs.Replace("&&", "&");
                fs = fs.Replace("??", "?");
                var pageSizeUrl = $"{option.PagerJsFunction}('{fs}', '{option.GridDiv}');";

                return(HtmlHelper4.PagedListPager2(
                           helper,
                           pagedList,
                           page => $"javascript:{option.PagerJsFunction}('{string.Format(pageUrl, page)}','{option.GridDiv}');",
                           new PagedListRenderOptions
                {
                    DisplayItemSliceAndTotal = true
                },
                           currentPageSize,
                           pageSizeUrl,
                           option.PageSizeList));
            }
            return(string.Empty);
        }
Ejemplo n.º 6
0
        private static string RenderRowButtons(IHtmlHelper helper, object item, DataGridOptions4 option)
        {
            var builder = new HtmlContentBuilder();

            if (!option.ButtonShowEnabled && !option.ButtonRefreshEnabled && !option.ButtonDeleteEnabled && !option.ButtonEditEnabled && option.Buttons.Count <= 0)
            {
                return("");
            }
            var width = string.Empty;

            if (option.ButtonColumnWidth > 0)
            {
                width = " width='" + option.ButtonColumnWidth + "'";
            }
            builder.AppendHtml($"<td{width}>");
            builder.AppendHtml("<div class='btn-group'>");

            var keyFieldValue = ValueConverter.GetFieldValue(item, option.KeyField);
            var keyText       = ValueConverter.GetFieldValue(item, option.TextField);

            foreach (var button in option.Buttons)
            {
                builder.AppendHtml(button.GetString()
                                   .Replace("KEYFIELD", keyFieldValue)
                                   .Replace("KEYTEXT", keyText)
                                   .Replace("btn-mini", "btn-xs"));
            }
            if (option.RowOtherButtons.Count > 0)
            {
                builder.AppendHtml(@"<div class=""btn-group""><a class=""btn btn-xs dropdown-toggle text-wrench"" data-toggle=""dropdown"" href=""#"">" +
                                   "<i class=\"fa fa-wrench\"></i> "
                                   + @"</a><ul class=""dropdown-menu"">");
                foreach (var button in option.RowOtherButtons)
                {
                    builder.AppendHtml("<li>" + button.GetString().Replace("KEYFIELD", keyFieldValue).Replace("KEYTEXT", keyText) + "</li>");
                }
                builder.AppendHtml("</ul></div>");
            }
            if (option.ButtonShowEnabled)
            {
                var buttonClass = option.ButtonShowCss;
                var url         = option.ButtonShowAction.IsEmpty()
                        ? $@"/{LibGeneral.GetContentUrl(helper.ViewContext.RouteData)}"
                        : $@"/{LibGeneral.GetContentUrl(helper.ViewContext.RouteData)}/{option.ButtonShowAction}";
                if (option.ButtonShowAction.Contains("?"))
                {
                    url += $"&{option.KeyField}={keyFieldValue}";
                }
                else
                {
                    url += $"/{keyFieldValue}";
                }

                var action = url;
                if (option.GridDiv != "divList")
                {
                    if (action.Contains("?"))
                    {
                        action += "&";
                    }
                    else
                    {
                        action += "?";
                    }
                    action += "grid=" + option.GridDiv;
                }
                var target = "";
                if (option.ButtonShowOpenNew)
                {
                    target = "target='_blank'";
                }
                builder.AppendHtml($"<a href='{action}' class='{buttonClass}' {target}><i class='fas fa-search'></i></a>");
            }
            if (option.ButtonEditEnabled)
            {
                bool drawEditButton;
                if (option.RowBackFormatter != null && !option.ButtonEditShowFunc.IsEmpty())
                {
                    var obj = Activator.CreateInstance(option.RowBackFormatter);
                    var a   = option.RowBackFormatter.GetMethod(option.ButtonEditShowFunc);
                    drawEditButton = (bool)a.Invoke(obj, new dynamic[1] {
                        item
                    });
                }
                else
                {
                    drawEditButton = true;
                }
                if (drawEditButton)
                {
                    var buttonClass = option.EditPopup ? option.ButtonEditPopupCss : option.ButtonEditCss;
                    var pop         = option.EditPopup ? option.Popup : "";
                    var url         = $@"/{LibGeneral.GetContentUrl(helper.ViewContext.RouteData)}/{option.ButtonEditAction}";
                    if (option.ButtonEditAction.Contains("?"))
                    {
                        url += $"&{option.KeyField}={keyFieldValue}";
                    }
                    else
                    {
                        url += $"/{keyFieldValue}";
                    }

                    var action = url;
                    if (option.GridDiv != "divList")
                    {
                        if (action.Contains("?"))
                        {
                            action += "&";
                        }
                        else
                        {
                            action += "?";
                        }
                        action += "grid=" + option.GridDiv;
                    }
                    var popIframe = option.EditPopup ? "data-fancybox-type='iframe'" : "";
                    builder.AppendHtml($"<a href='{action}' class='{buttonClass}' {pop} {popIframe}><i class='fas fa-edit'></i></a>");
                }
            }
            if (option.ButtonDeleteEnabled)
            {
                bool drawDeleteButton;
                if (option.RowBackFormatter != null && !option.ButtonDeleteShowFunction.IsEmpty())
                {
                    var obj = Activator.CreateInstance(option.RowBackFormatter);
                    var a   = option.RowBackFormatter.GetMethod(option.ButtonDeleteShowFunction);
                    if (a == null)
                    {
                        throw new Exception("Geçersiz func: " + option.ButtonDeleteShowFunction);
                    }
                    drawDeleteButton = (bool)a.Invoke(obj, new dynamic[1] {
                        item
                    });
                }
                else
                {
                    drawDeleteButton = true;
                }
                if (drawDeleteButton)
                {
                    var url = $@"/{LibGeneral.GetContentUrl(helper.ViewContext.RouteData)}/{option.ButtonDeleteAction}";
                    if (option.ButtonDeleteAction.Contains("?"))
                    {
                        url += $"&{option.KeyField}={keyFieldValue}";
                    }
                    else
                    {
                        url += $"/{keyFieldValue}";
                    }

                    var action = url;
                    if (action.Contains("?"))
                    {
                        action += "&";
                    }
                    else
                    {
                        action += "?";
                    }
                    action += "grid=" + option.GridDiv;
                    var text = string.Format(Text.AskDelete, keyText).Replace("'", "\"");
                    builder.AppendHtml(string.Format(
                                           "<a href='javascript:;' data-posturl='{0}' class='btnGridDelete {1}' data-confirm='{2}'><i class='fas fa-trash'></i></a>",
                                           action,
                                           option.ButtonDeleteCss,
                                           text));
                }
            }
            builder.AppendHtml("</div>");
            builder.AppendHtml("</td>");
            return(builder.GetString());
        }
Ejemplo n.º 7
0
        public static HtmlString DataGrid4 <T>(this IHtmlHelper helper, IEnumerable <T> data, DataColumn[] columns, DataGridOptions4 option)
            where T : class
        {
            var _query           = helper.ViewContext.HttpContext.Request.QueryString;
            var _queryDictionary = QueryHelpers.ParseQuery(_query.ToString());
            var _queryItems      = _queryDictionary.SelectMany(x => x.Value, (col, value) => new KeyValuePair <string, string>(col.Key, value)).ToList();
            var _queryParams     = _query.ToUriComponent();

            if (!option.PagerAndShortAction.IsEmpty())
            {
                var psss = option.PagerAndShortAction.Split('?');
                if (psss.Length > 1)
                {
                    _queryParams = _queryParams.Replace("?" + psss[1], "");
                }
            }

            var _colCount = 0;
            var items     = data;

            if (items == null)
            {
                var content = new HtmlContentBuilder().AppendHtml(option.EmptyData);
                return(new HtmlString(content.GetString()));
            }

            var _sorter = new Sorter(_queryItems, option.SortKeyword, option.PagerAndShortAction);
            var _filter = new Filter4(_queryDictionary, _queryItems, option.PagerKeyword,
                                      helper.ViewContext.RouteData, option.PagerAndShortAction,
                                      helper, option.PagerJsFunction, option.GridDiv);

            if (option.FilteringEnabled && !(data is PagedList <T>) && !(data is StaticPagedList <T>))
            {
                var kp = _filter.GetWhereString();
                if (kp.Where != null)
                {
                    items = items.AsQueryable().Where(kp.Where, kp.Params.ToArray());
                }
            }

            #region SORT DATA
            if (option.Sortable && !(data is PagedList <T>) && !(data is StaticPagedList <T>))
            {
                if (_sorter.List.Count == 0 && option.DefaultSorting)
                {
                    if (!option.SortDefaultFieldName.IsEmpty())
                    {
                        _sorter.List.Add(new SorterInfo()
                        {
                            Direction = option.SortDefaultDirection, Keyword = option.SortDefaultFieldName
                        });
                    }
                    //if (option.SortDefaultFieldNames != null)
                    //{
                    //    foreach (string sortinfodefaultname in option.SortDefaultFieldNames)
                    //    {
                    //        _sorter.List.Add(new SorterInfo()
                    //        {
                    //            Direction = option.SortDefaultDirection,
                    //            Keyword = sortinfodefaultname
                    //        });
                    //    }
                    //}
                }
                var sorting = string.Empty;
                foreach (var info in _sorter.List)
                {
                    if (!sorting.IsEmpty())
                    {
                        sorting += ",";
                    }
                    sorting += String.Format("{0} {1}", info.Keyword, info.Direction);
                }
                if (!sorting.IsEmpty())
                {
                    items = items.AsQueryable().OrderBy(sorting);
                }
            }
            #endregion

            #region DO PAGING
            var currentPageSize      = option.DefaultPageSize;
            var currentPageIndexItem = _queryItems.FirstOrDefault(d => d.Key == option.PagerKeyword);
            var pageIndex            = 0;
            if (!currentPageIndexItem.Value.IsEmpty())
            {
                int.TryParse(currentPageIndexItem.Value, out pageIndex);
            }
            if (option.PagerEnabled && !(data is PagedList <T>) && !(data is StaticPagedList <T>))
            {
                var currentPageSizeStr = _queryItems.FirstOrDefault(d => d.Key == option.PageSizeKeyword);
                if (!currentPageSizeStr.Value.IsEmpty())
                {
                    int.TryParse(currentPageSizeStr.Value, out currentPageSize);
                }
                items          = new PagedList <T>(items, pageIndex, currentPageSize);
                TotalRowCount  = (items as PagedList <T>).TotalItemCount;
                TotalPageCount = (items as PagedList <T>).PageCount;
            }
            #endregion

            T firstItem = default;
            if (items != null && items.Any())
            {
                firstItem = items.First();
            }
            Type firstItemType = null;
            if (firstItem != null)
            {
                firstItemType = firstItem.GetType();
            }

            var writer      = new HtmlContentBuilder();
            var baseUrl     = LibGeneral.GetContentUrl(helper.ViewContext.RouteData);
            var fs          = $@"/{baseUrl}/{option.PagerAndShortAction}{_queryParams}";
            var _refreshUrl = $"{option.PagerJsFunction}(\"{fs}\",\"{option.GridDiv}\");";

            if (option.PagerEnabled && (option.PagerLocation == PagerLocationTypes.Top || option.PagerLocation == PagerLocationTypes.TopAndBottom))
            {
                if (data is PagedList <T> || data is StaticPagedList <T> )
                {
                    var pager = RenderPager(helper, data, option, currentPageSize, _queryItems);
                    writer.AppendHtmlLine(pager);
                }
                else
                {
                    var pager = RenderPager(helper, items, option, currentPageSize, _queryItems);
                    writer.AppendHtmlLine(pager);
                }
            }

            var cssDiv = string.Empty;
            if (option.Responsive)
            {
                cssDiv = $" class=\"table-responsive\"";
            }
            writer.AppendHtmlLine($"<div id='dataGrid-{option.GridDiv}' {cssDiv} data-refreshurl='{_refreshUrl}'> ");

            var cssTable = string.Empty;
            if (!option.CssTable.IsEmpty())
            {
                cssTable = $" class=\"{option.CssTable}\"";
            }
            var idTable = string.Empty;
            if (!option.TableId.IsEmpty())
            {
                idTable = $" id=\"{option.TableId}\"";
            }
            writer.AppendHtmlLine(RenderHeaderBar2(option));
            writer.AppendHtmlLine($"<table{idTable}{cssTable}>");

            if (option.ShowHeader)
            {
                writer.AppendHtmlLine($"<thead>");
                _colCount = columns.Count(d => d.Visible);
                if (option.ButtonDeleteEnabled || option.ButtonEditEnabled || option.ButtonRefreshEnabled)
                {
                    _colCount++;
                }
                if (option.FilteringEnabled)
                {
                    writer.AppendHtmlLine(RenderFilterRow(helper, columns, firstItemType, _filter));
                }
                writer.AppendHtmlLine(RenderHeader <T>(helper, columns, option, firstItemType, _refreshUrl, _sorter, _filter));
                writer.AppendHtmlLine($"</thead>");
            }

            writer.AppendHtmlLine($"<tbody>");
            foreach (var item in items)
            {
                writer.AppendHtmlLine(RenderRow(helper, columns, item, option));
            }

            writer.AppendHtmlLine($"</tbody>");
            writer.AppendHtmlLine("</table>");
            writer.AppendHtmlLine("</div>");

            if (option.FilteringEnabled && columns.Any(d => !d.FilterValue.IsEmpty()))
            {
                writer.AppendHtmlLine(RenderFilterRowFooter(_filter, _colCount));
            }

            if (option.PagerEnabled && (option.PagerLocation == PagerLocationTypes.Bottom || option.PagerLocation == PagerLocationTypes.TopAndBottom))
            {
                if (data is PagedList <T> || data is StaticPagedList <T> )
                {
                    var pager = RenderPager(helper, data, option, currentPageSize, _queryItems);
                    writer.AppendHtmlLine(pager);
                }
                else
                {
                    var pager = RenderPager(helper, items, option, currentPageSize, _queryItems);
                    writer.AppendHtmlLine(pager);
                }
            }

            return(new HtmlString(writer.GetString()));
        }
Ejemplo n.º 8
0
        private static string RenderHeader <T>(IHtmlHelper helper, IEnumerable <DataColumn> columns, DataGridOptions4 option, Type firstItemType,
                                               string refreshUrl, Sorter sorter, Filter4 filter)
        {
            var builder = new HtmlContentBuilder();

            builder.AppendHtml("<tr>");
            var urlOperator = option.PagerAndShortAction.IndexOf("?") > -1 ? "&" : "?";

            if (option.ButtonShowEnabled || option.ButtonDeleteEnabled || option.ButtonEditEnabled || option.Buttons.Count > 0 || option.ButtonRefreshEnabled)
            {
                var width = string.Empty;
                if (option.ButtonColumnWidth > 0)
                {
                    width = " width='" + option.ButtonColumnWidth + "'";
                }
                builder.AppendHtml($"<th{width}>");
                builder.AppendHtml("<div class='btn-group'>");
                if (option.ButtonInsertEnabled)
                {
                    var action = option.ButtonInsertAction;
                    if (option.GridDiv != "divList")
                    {
                        if (action.Contains("?"))
                        {
                            action += "&";
                        }
                        else
                        {
                            action += "?";
                        }
                        action += "grid=" + option.GridDiv;
                    }
                    var buttonClass = option.InsertPopup ? option.ButtonInsertPopupCss : option.ButtonInsertCss;
                    var pop         = option.InsertPopup ? option.Popup : "";
                    builder.AppendHtml(string.Format("<a href='{0}/{1}' class='{2}' {4}>{3}</a>",
                                                     $"/{LibGeneral.GetContentUrl(helper.ViewContext.RouteData)}",
                                                     action,
                                                     buttonClass,
                                                     "<i class=\"fas fa-plus\"></i>",
                                                     pop));
                }
                if (option.ButtonRefreshEnabled)
                {
                    builder.AppendHtml($"<a onClick='{refreshUrl}' id='btnGridRefresh-{option.GridDiv}' class='{option.ButtonRefreshCss}'><i class=\"fas fa-sync-alt\"></i></a>");
                }
                builder.AppendHtml("</div>");
                builder.AppendHtml("</th>");
            }
            foreach (var field in columns.Where(d => d.Visible && d.DataColumnType == DataColumnTypes.CommandColumn))
            {
                var cssClass = string.Empty;
                if (!field.HeaderCssClass.IsEmpty())
                {
                    cssClass = $" class='{field.HeaderCssClass}'";
                }
                var width = string.Empty;
                if (field.Width > 0)
                {
                    width = $" width='{field.Width}'";
                }
                if (field.Width > 0)
                {
                    builder.AppendHtml($"<th{width}{cssClass}>");
                }
                else
                {
                    builder.AppendHtml($"<th{cssClass}>");
                }
                builder.AppendHtml($"<span class='textHeader'>{field.Caption}</span>");
                builder.AppendHtml("</th>");
            }
            foreach (var field in columns.Where(d => d.Visible && d.DataColumnType != DataColumnTypes.CommandColumn))
            {
                var cssClass = string.Empty;
                if (!field.HeaderCssClass.IsEmpty())
                {
                    cssClass = $" class='{field.HeaderCssClass}'";
                }
                var width = string.Empty;
                if (field.Width > 0)
                {
                    width = $" width='{field.Width}'";
                }
                if (field.Width > 0)
                {
                    builder.AppendHtml($"<th{width}{cssClass}>");
                }
                else
                {
                    builder.AppendHtml($"<th{cssClass}>");
                }
                if (field.DataColumnType == DataColumnTypes.BoundColumn)
                {
                    if (field.Caption.IsEmpty())
                    {
                        field.Caption = Digger.GetDisplayName(typeof(T), field.FieldName);
                    }
                    builder.AppendHtml("<div class='tableDiv'>");
                    if (option.Sortable && field.Sortable)
                    {
                        var sortFieldName = field.SortField.IsEmpty() ? field.FieldName : field.SortField;
                        var sortImg       = sorter.GetSortImg4(sortFieldName);
                        var sortParam     = sorter.GetSortParam(sortFieldName, option.SortDefaultFieldName, option.SortDefaultDirection);

                        var url = $@"/{LibGeneral.GetContentUrl(helper.ViewContext.RouteData)}/{option.PagerAndShortAction}{urlOperator}{option.SortKeyword}={sortParam}&{sorter.CleanQueryString}";

                        builder.AppendHtml($"<a class='textHeader' href=\"javascript:{option.PagerJsFunction}('{url}', '{option.GridDiv}');\">{field.Caption}</a>");
                        builder.AppendHtml(sortImg);
                    }
                    else
                    {
                        builder.AppendHtml($"<span class='textHeader'>{field.Caption}</span>");
                    }

                    if (option.FilteringEnabled && field.Filterable && (!field.FieldName.IsEmpty() || !field.FilterField.IsEmpty()))
                    {
                        var fieldType = field.FilterField.IsEmpty()
                                       ? Digger.GetType(firstItemType, field.FieldName)
                                       : Digger.GetType(firstItemType, field.FilterField);
                        if (filter.CanFilterable(fieldType))
                        {
                            var fReplace = field.FilterField.IsEmpty()
                                               ? field.FieldName.Replace(".", "__")
                                               : field.FilterField.Replace(".", "__");
                            builder.AppendHtml(string.Format("<a href='#filter_{0}' data-toggle='modal' class='textHeader filtre-image'><img class='tableImg' src='" +
                                                             @"/assets/zero/mvcgrid/images/filter.png"
                                                             + "' /></a>", fReplace));
                        }
                    }
                    builder.AppendHtml("</div>");
                }
                else if (field.DataColumnType == DataColumnTypes.SelectColumn)
                {
                    builder.AppendHtml("<input type='checkbox' id='chkGridSelectAllRow' />");
                }
                else
                {
                    builder.AppendHtml($"<span class='textHeader'>{field.Caption}</span>");
                }
                builder.AppendHtml("</th>");
            }
            builder.AppendHtml("</tr>");
            return(builder.GetString());
        }