private static void SetReportGroup(string gridID, AdvanceGridLayout gridLayout, StringBuilder sbGrid) { if (gridLayout.GridGroupHeader != null) { sbGrid.AppendLine("$('#" + gridID + "').jqGrid('setGroupHeaders', {"); sbGrid.AppendLine(" useColSpanStyle: true, "); sbGrid.AppendFormat("groupHeaders:[{0}] ", GetGroupColModel(gridLayout.GridGroupHeader)); sbGrid.AppendLine(" });"); } }
public static MvcHtmlString AppReportPrintFor(this HtmlHelper htmlHelper, DataTable dt, AdvanceGridLayout layout) { StringBuilder sb = ExcelHelper.CreateExcel(dt, layout); return(MvcHtmlString.Create(sb.ToString())); }
public static void CreateAdvanceGridLayoutCache(HttpContextBase HttpContext, string areaName, string layoutName) { AdvanceGridLayout layout = XmlHelper.GetAdvanceGridLayout(areaName, layoutName); HttpContext.Cache.Add(layoutName + "GridLayout", layout, null, DateTime.Now.AddHours(5), TimeSpan.Zero, CacheItemPriority.High, null); }
public static MvcHtmlString AppReportGridFor(this HtmlHelper htmlHelper, UrlHelper urlHelper, string pageId, string formId, string gridId, string url, AdvanceGridLayout gridLayout, int gridHeight) { string inputName = gridId + AppMember.HideString; gridId = gridId + pageId; formId = formId + pageId; string pagerId = gridId + "pager"; StringBuilder sbGrid = new StringBuilder(); sbGrid.AppendLine("<script type=\"text/javascript\">"); sbGrid.AppendLine("$(function(){"); #region grid设置 sbGrid.AppendLine("$('#%%GRIDID%%').jqGrid({".Replace("%%GRIDID%%", gridId)); sbGrid.AppendFormat("url:'{0}',", url); sbGrid.AppendFormat("mtype:'{0}',", "post"); sbGrid.AppendLine(@"datatype: ""json"","); sbGrid.AppendFormat("colNames:[{0}],", GetColNames(gridLayout.GridLayouts)); sbGrid.AppendFormat("colModel:[{0}],", GetColModel(urlHelper, gridLayout.GridLayouts)); SetGridProperty(gridId, gridLayout.GridTitle, pagerId, sbGrid, gridHeight, false, false, 0, false, false, true); SetGridEvent(pageId, formId, gridId, sbGrid, "", "", ""); sbGrid.Length--; sbGrid.AppendLine("});"); SetReportGroup(gridId, gridLayout, sbGrid); SetGridPage(gridId, pagerId, sbGrid); sbGrid.AppendLine("});"); #region 窗体改变大小时,重新设定grid的宽度和高度 //gridResize(gridId, sbGrid); #endregion sbGrid.AppendLine("</script>"); #endregion string ss = sbGrid.ToString(); GenerateGridHtml(gridId, pagerId, inputName, sbGrid); return(MvcHtmlString.Create(sbGrid.ToString())); }