public OrdersJqGridModel() { OrdersGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "OrderID", // always set PrimaryKey for Add,Edit,Delete operations // if not set, the first column will be assumed as primary key PrimaryKey = true, Editable = false, Width = 50 }, new JQGridColumn { DataField = "OrderDate", Editable = true, Width = 100, DataFormatString = "{0:d}" }, new JQGridColumn { DataField = "CustomerID", Editable = true, Width = 100 }, new JQGridColumn { DataField = "Freight", Editable = true, Width = 75 }, new JQGridColumn { DataField = "ShipName", Editable = true } }, Width = Unit.Pixel(640) }; OrdersGrid.ToolBarSettings.ShowRefreshButton = true; }
public RentrakJqGridModel() { RentrakGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "ID", // always set PrimaryKey for Add,Edit,Delete operations // if not set, the first column will be assumed as primary key PrimaryKey = true, Editable = false, Width = 50 }, new JQGridColumn { DataField = "Market", Editable = true, Width = 200}, new JQGridColumn { DataField = "Episode", Editable = true, Width = 200 }, new JQGridColumn { DataField = "Series", Editable = true, Width = 200 }, new JQGridColumn { DataField = "Station", Editable = true, Width = 200 } }, Width = Unit.Pixel(850) }; RentrakGrid.ToolBarSettings.ShowRefreshButton = true; }
/// <summary> /// Initializes a new instance of the <see cref="EmployeeJqGridViewData"/> class. /// </summary> public EmployeeJqGridViewData() { EmployeeGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "EmployeeID", // always set PrimaryKey for Add,Edit,Delete operations // if not set, the first column will be assumed as primary key PrimaryKey = true, Editable = false, Width = 100 }, new JQGridColumn { DataField = "NationalIDNumber", Editable = false }, new JQGridColumn { DataField = "Title", Editable = false, Width = 200 }, new JQGridColumn { DataField = "BirthDate", Editable = false, DataFormatString = "{0:d}" } }, Width = Unit.Pixel(650), Height = Unit.Pixel(250) }; EmployeeGrid.ToolBarSettings.ShowRefreshButton = true; }
internal static string GetAttachEditorsFunction(JQGrid grid, string editorType, string editorControlID) { new JavaScriptSerializer(); GetListOfColumns(grid); GetListOfEditors(grid); StringBuilder builder = new StringBuilder(); builder.Append("function(el) {"); builder.Append("setTimeout(function() {"); builder.AppendFormat("var ec = '{0}';", editorControlID); if (editorType == "datepicker") { builder.Append("if (typeof(jQuery(el).datepicker) !== 'function')"); builder.Append("alert('JQDatePicker javascript not present on the page. Please, include jquery.jqDatePicker.min.js');"); builder.Append("jQuery(el).datepicker( eval(ec + '_dpid') );"); } if (editorType == "autocomplete") { builder.Append("if (typeof(jQuery(el).autocomplete) !== 'function')"); builder.Append("alert('JQAutoComplete javascript not present on the page. Please, include jquery.jqAutoComplete.min.js');"); builder.Append("jQuery(el).autocomplete( eval(ec + '_acid') );"); } builder.Append("},200);"); builder.Append("}"); return builder.ToString(); }
public JQGridModel() { RetailDataGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "UserId", Visible = false, PrimaryKey = true }, new JQGridColumn { DataField = "UserName", Visible = false, }, new JQGridColumn { DataField = "UserEmail", Visible = false, }, new JQGridColumn { DataField = "UserRole", Visible = false, }, new JQGridColumn { DataField = General.GetString("VIEW"), Visible = false, Formatter = new CustomFormatter{ FormatFunction = "formatEditLink",}}, new JQGridColumn { DataField = General.GetString("DELETE"), Visible = false, Formatter = new CustomFormatter{ FormatFunction = "formatDeletLink",}}, }, Width = Unit.Pixel(600), Height = Unit.Percentage(300), SortSettings = new SortSettings { InitialSortColumn = "Position", }, TreeGridSettings = new TreeGridSettings { Enabled = true } }; }
public static DataTable ToDataTable(this IEnumerable en, JQAutoComplete autoComplete) { JQGrid grid = new JQGrid { Columns = { new JQGridColumn { DataField = autoComplete.DataField } } }; return en.ToDataTable(grid); }
public ModeracionCategorias() { CategoriasGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "Id", PrimaryKey = true, Editable = false, Width = 50 }, new JQGridColumn { DataField = "Descripcion", Editable = true, Width = 200 }, new JQGridColumn { DataField = "Estado", Editable = true, Width = 100 } }, Width = Unit.Pixel(600) }; CategoriasGrid.ToolBarSettings.ShowRefreshButton = true; //CategoriasGrid.ToolBarSettings.ShowViewRowDetailsButton = true; CategoriasGrid.PagerSettings.PageSize = 6; //CategoriasGrid.PagerSettings. }
public OEMModel() { OEMGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "process", HeaderText="PROCESS", Editable = true, Width = 100 }, new JQGridColumn { DataField = "trandate", HeaderText="DUE DATE", Editable = true, Width = 100 }, new JQGridColumn { DataField = "type", HeaderText="TYPE", Editable = true, Width = 100 }, new JQGridColumn { DataField = "tagno", HeaderText="TAGNO", Editable = true, Width = 100 }, new JQGridColumn { DataField = "item", HeaderText="ITEM", Editable = true, Width = 100 }, new JQGridColumn { DataField = "qty", HeaderText="ORDER QTY", Editable = true, Width = 100 }, new JQGridColumn { DataField = "custno", HeaderText="CUST NO", Editable = true, Width = 100 }, new JQGridColumn { DataField = "custname", HeaderText="CUST NAME", Editable = true, Width = 100 }, //new JQGridColumn { DataField = "shipto", HeaderText="SHIP TO", // Editable = true, // Width = 100 }, //new JQGridColumn { DataField = "cycle", HeaderText="CYCLE NO", // Editable = true, // Width = 100 }, //new JQGridColumn { DataField = "zone", HeaderText="ZONE", // Editable = true, // Width = 100 }, new JQGridColumn { DataField = "status", HeaderText="STATUS", Editable = true, Width = 100 }, //new JQGridColumn { DataField = "shipvia", HeaderText="SHIP VIA", // Editable = true, // Width = 100 }, new JQGridColumn { DataField = "finish", HeaderText="FINISHED TIME", Editable = true, Width = 100 } //new JQGridColumn { DataField = "takeout_time", // Editable = true, // Width = 100}, //new JQGridColumn { DataField = "takeout_user", // Editable = true, // Width = 100}, //new JQGridColumn { DataField = "job_order_no", PrimaryKey = true, // Width = 100 } } }; }
public DictionaryJqGridModel() { DictionaryGrid=new JQGrid() { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "Id", PrimaryKey = true, Editable = false, Searchable = false, HeaderText = "Идентификатор", TextAlign = TextAlign.Left, Visible = false, }, new JQGridColumn { DataField = "Name", Editable = true, DataType = typeof (string), TextAlign = TextAlign.Left, HeaderText = "Название справочника", Width = 40 }, new JQGridColumn { Searchable = false, TextAlign = TextAlign.Center, HeaderText = "", Width = 10, Formatter = new CustomFormatter { FormatFunction = "FormatDetails" } } }, AutoWidth = true, Height = Unit.Percentage(100), //PagerSettings = new PagerSettings() { PageSizeOptions = "[5,10,15,25,30]" }, SearchDialogSettings = { MultipleSearch = true, Width = 800 }, SortSettings = new SortSettings() { InitialSortColumn = "Id", InitialSortDirection = Trirand.Web.Mvc.SortDirection.Asc }, ToolBarSettings = { ShowSearchButton = true, ShowRefreshButton = true, ShowEditButton = false, ShowAddButton = false, ShowDeleteButton = false }, }; }
private void setproperties(JQGrid gr) { gr.Height = Unit.Pixel(200); gr.DataUrl = Url.Action("cargardatos"); gr.EditUrl = Url.Action("editardatos"); gr.ToolBarSettings.ShowAddButton = true; gr.ToolBarSettings.ShowEditButton = true; gr.ToolBarSettings.ShowEditButton = true; }
public static DataTable ToDataTable(this IEnumerable en, JQAutoComplete autoComplete) { JQGrid grid = new JQGrid(); JQGridColumn item = new JQGridColumn { DataField = autoComplete.DataField }; grid.Columns.Add(item); return en.ToDataTable(grid); }
private string GetColNames(JQGrid grid) { string[] strArray = new string[grid.Columns.Count]; for (int i = 0; i < grid.Columns.Count; i++) { JQGridColumn column = grid.Columns[i]; strArray[i] = string.IsNullOrEmpty(column.HeaderText) ? column.DataField : column.HeaderText; } return new JavaScriptSerializer().Serialize(strArray); }
public void SetUpGrid(Trirand.Web.Mvc.JQGrid ordersGrid) { // Customize/change some of the default settings for this model // ID is a mandatory field. Must by unique if you have several grids on one page. ordersGrid.ID = "BillingGrid"; // Setting the DataUrl to an action (method) in the controller is required. // This action will return the data needed by the grid ordersGrid.DataUrl = Url.Action("DataRequested"); ordersGrid.EditUrl = Url.Action("EditRows"); }
private string GetColModel(JQGrid grid) { Hashtable[] hashtableArray = new Hashtable[grid.Columns.Count]; for (int i = 0; i < grid.Columns.Count; i++) { JsonColModel model = new JsonColModel(grid.Columns[i], grid); hashtableArray[i] = model.JsonValues; } return JsonColModel.RemoveQuotesForJavaScriptMethods(new JavaScriptSerializer().Serialize(hashtableArray), grid); }
public static int GetPrimaryKeyIndex(JQGrid grid) { foreach (JQGridColumn column in grid.Columns) { if (column.PrimaryKey) { return grid.Columns.IndexOf(column); } } return 0; }
private string GetChildSubGridJavaScript(JQGrid grid) { StringBuilder builder = new StringBuilder(); builder.Append("<script type='text/javascript'>\n"); builder.AppendFormat("function showSubGrid_{0}(subgrid_id, row_id, message, suffix) {{", grid.ID); builder.Append("var subgrid_table_id, pager_id;\r\n\t\t subgrid_table_id = subgrid_id+'_t';\r\n\t\t pager_id = 'p_'+ subgrid_table_id;\r\n if (suffix) { subgrid_table_id += suffix; pager_id += suffix; }\r\n if (message) jQuery('#'+subgrid_id).append(message); \r\n\t\t jQuery('#'+subgrid_id).append('<table id=' + subgrid_table_id + ' class=scroll></table><div id=' + pager_id + ' class=scroll></div>');\r\n "); builder.Append(this.GetStartupOptions(grid, true)); builder.Append("}"); builder.Append("</script>"); return builder.ToString(); }
public static Hashtable GetFooterInfo(JQGrid grid) { Hashtable hashtable = new Hashtable(); if (grid.AppearanceSettings.ShowFooter) { foreach (JQGridColumn column in grid.Columns) { hashtable[column.DataField] = column.FooterValue; } } return hashtable; }
public static string RemoveQuotesForJavaScriptMethods(string input, JQGrid grid) { string str = input; foreach (JQGridColumn column in grid.Columns) { if (column.Formatter != null) { JQGridColumnFormatter formatter = column.Formatter; if (formatter is CustomFormatter) { CustomFormatter formatter2 = (CustomFormatter) formatter; string oldValue = string.Format("\"formatter\":\"{0}\"", formatter2.FormatFunction); string newValue = string.Format("\"formatter\":{0}", formatter2.FormatFunction); str = str.Replace(oldValue, newValue); oldValue = string.Format("\"unformat\":\"{0}\"", formatter2.UnFormatFunction); newValue = string.Format("\"unformat\":{0}", formatter2.UnFormatFunction); str = str.Replace(oldValue, newValue); } } foreach (JQGridEditClientSideValidator validator in column.EditClientSideValidators) { if (validator is CustomValidator) { CustomValidator validator2 = (CustomValidator) validator; string str4 = string.Format("\"custom_func\":\"{0}\"", validator2.ValidationFunction); string str5 = string.Format("\"custom_func\":{0}", validator2.ValidationFunction); str = str.Replace(str4, str5); } } if (column.EditType == EditType.Custom) { string str6 = string.Format("\"custom_element\":\"{0}\"", column.EditTypeCustomCreateElement); string str7 = string.Format("\"custom_element\":{0}", column.EditTypeCustomCreateElement); str = str.Replace(str6, str7); str6 = string.Format("\"custom_value\":\"{0}\"", column.EditTypeCustomGetValue); str7 = string.Format("\"custom_value\":{0}", column.EditTypeCustomGetValue); str = str.Replace(str6, str7); } if ((column.Editable && (column.EditType == EditType.DatePicker)) || (column.EditType == EditType.AutoComplete)) { string str8 = GridUtil.GetAttachEditorsFunction(grid, column.EditType.ToString().ToLower(), column.EditorControlID); str = str.Replace(string.Concat(new object[] { '"', "attachEditControlsScript", column.DataField, '"' }), str8); str = str.Replace('"' + "dataInit" + '"', "dataInit"); } if ((column.Searchable && (column.SearchType == SearchType.DatePicker)) || (column.SearchType == SearchType.AutoComplete)) { string str9 = GridUtil.GetAttachEditorsFunction(grid, column.SearchType.ToString().ToLower(), column.SearchControlID); str = str.Replace(string.Concat(new object[] { '"', "attachSearchControlsScript", column.DataField, '"' }), str9); str = str.Replace('"' + "dataInit" + '"', "dataInit"); } } return str; }
public static DataTable ToDataTable(this IEnumerable en, JQGrid grid) { DataTable table = new DataTable(); DataView view = en as DataView; if (view != null) { return view.ToTable(); } if (en != null) { table = ObtainDataTableFromIEnumerable(en, grid); } return table; }
public BooksJqGridModel() { BooksGrid = new JQGrid { Columns = new List<JQGridColumn> { new JQGridColumn {DataField = "Id", PrimaryKey = true, Visible = false, Searchable = false}, new JQGridColumn {DataField = "Title", Editable = true}, new JQGridColumn {DataField = "Author", Editable = true}, new JQGridColumn {DataField = "Description", Editable = true}, }, ToolBarSettings = {ShowRefreshButton = true, ShowAddButton = true} }; }
public static string GetWhereClause(JQGrid grid, string searchField, string searchString, string searchOper) { string str = " && "; string str2 = ""; new Hashtable(); SearchArguments args = new SearchArguments { SearchColumn = searchField, SearchString = searchString, SearchOperation = GetSearchOperationFromString(searchOper) }; string str3 = (str2.Length > 0) ? str : ""; string str4 = ConstructLinqFilterExpression(grid, args); return (str2 + str3 + str4); }
internal static List<string> GetListOfColumns(JQGrid grid) { List<string> result = new List<string>(); grid.Columns.FindAll(delegate (JQGridColumn c) { if (c.EditType != EditType.DatePicker) { return c.EditType == EditType.AutoComplete; } return true; }).ForEach(delegate (JQGridColumn c) { Guard.IsNotNullOrEmpty(c.EditorControlID, "JQGridColumn.EditorControlID", "must be set to the ID of the editing control control if EditType = DatePicker or EditType = AutoComplete"); result.Add(c.EditType.ToString().ToLower() + ":" + c.DataField); }); return result; }
internal static List<string> GetListOfSearchEditors(JQGrid grid) { List<string> result = new List<string>(); grid.Columns.FindAll(delegate (JQGridColumn c) { if (c.SearchType != SearchType.DatePicker) { return c.SearchType == SearchType.AutoComplete; } return true; }).ForEach(delegate (JQGridColumn c) { Guard.IsNotNullOrEmpty(c.SearchControlID, "JQGridColumn.SearchControlID", "must be set to the ID of the searching control control if SearchType = DatePicker or SearchType = AutoComplete"); result.Add(c.SearchControlID); }); return result; }
public OrdersJqGridModelNG() { OrdersGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "result_date", Editable = true, //DataFormatString = "{0:dd/MM/yyyy}", Width = 100 }, new JQGridColumn { DataField = "result_time", Editable = true, DataFormatString = "'{0}", Width = 100 }, new JQGridColumn { DataField = "wc", Editable = true, Width = 100 }, new JQGridColumn { DataField = "finished_goods_code", Editable = true, Width = 100 }, new JQGridColumn { DataField = "parent_job_order_no", // always set PrimaryKey for Add,Edit,Delete operations // if not set, the first column will be assumed as primary key PrimaryKey = true, Editable = true, Width = 100 }, new JQGridColumn { DataField = "part_code", Editable = true, Width = 100 }, new JQGridColumn { DataField = "part_job_order_no", Editable = true, Width = 100 }, new JQGridColumn { DataField = "qty", DataFormatString = "{0:N0}", Editable = true, Width = 100 }, new JQGridColumn { DataField = "weight", Editable = true, Width = 100 }, new JQGridColumn { DataField = "totalweight", Editable = true, Width = 100 }, new JQGridColumn { DataField = "entry_user", Editable = true, Width = 100 } } }; }
public static string GetWhereClause(JQGrid grid, string filters) { JsonMultipleSearch search = new JavaScriptSerializer().Deserialize<JsonMultipleSearch>(filters); string str = ""; foreach (MultipleSearchRule rule in search.rules) { SearchArguments args = new SearchArguments { SearchColumn = rule.field, SearchString = rule.data, SearchOperation = GetSearchOperationFromString(rule.op) }; string str2 = (str.Length > 0) ? (" " + search.groupOp + " ") : ""; str = str + str2 + ConstructLinqFilterExpression(grid, args); } return str; }
public LogJqGridModel() { LogGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "Id", PrimaryKey = true, DataType = typeof(int), Editable = false, Visible = false, }, new JQGridColumn { DataField = "Date", HeaderText = "Дата", DataType = typeof(DateTime), Width = 140, Searchable = true, SearchToolBarOperation = SearchOperation.IsLessThan, SearchType = SearchType.DatePicker, SearchControlID = "LogCreatedPicker", // dataEvents: [type: 'change', fn: function(e) { $("#elem")[0].triggerToolbar() }] //DataFormatString = "{0:dd.MM.yyyy}" }, new JQGridColumn { DataField = "Message", HeaderText = "Сообщение", DataType = typeof(string), Editable = true, Width = 500, Searchable = true, }, } }; //LogGrid.ClientSideEvents.AfterAjaxRequest = "OrderByDateCreated"; LogGrid.SortSettings = new SortSettings() { InitialSortColumn = "Date", InitialSortDirection = Trirand.Web.Mvc.SortDirection.Desc }; LogGrid.ToolBarSettings.ShowRefreshButton = true; LogGrid.ToolBarSettings.ToolBarPosition = ToolBarPosition.Top; //LogGrid.Width = 650; LogGrid.AutoWidth = false; LogGrid.Height = Unit.Pixel(200); LogGrid.ToolBarSettings.ShowSearchToolBar = true; }
public TimeChartExportModel() { TimeChartGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "cust_no", HeaderText="CUST NO", Editable = true, Width = 100 }, new JQGridColumn { DataField = "process_no", HeaderText="PROCESS NO", Editable = true, Width = 100 }, new JQGridColumn { DataField = "start_time", HeaderText="START TIME", Editable = true, Width = 100 }, new JQGridColumn { DataField = "finished_time", HeaderText="FINISHED TIME", Editable = true, Width = 100 }, new JQGridColumn { DataField = "cycle_no", HeaderText="CYCLE NO", Editable = true, Width = 100 }, new JQGridColumn { DataField = "prepare_n_date", HeaderText="PREPARE DATE", Editable = true, Width = 100 }, new JQGridColumn { DataField = "shipto", HeaderText="SHIP TO", Editable = true, Width = 100 }, new JQGridColumn { DataField = "username_id", HeaderText="UPDATE BY", Editable = true, Width = 100 }, new JQGridColumn { DataField = "update_date", HeaderText="UPDATE DATE", Editable = true, Width = 100}, new JQGridColumn { DataField = "update_time", HeaderText="UPDATE TIME", Editable = true, Width = 100}, new JQGridColumn { DataField = "cust_type", HeaderText="CUST TYPE", Editable = true, Width = 100 } //new JQGridColumn { DataField = "job_order_no", PrimaryKey = true, // Width = 100 } } }; }
public static string GetWhereClause(JQGrid grid, NameValueCollection queryString) { string str = " && "; string str2 = ""; new Hashtable(); foreach (JQGridColumn column in grid.Columns) { string str3 = queryString[column.DataField]; if (!string.IsNullOrEmpty(str3)) { SearchArguments args = new SearchArguments { SearchColumn = column.DataField, SearchString = str3, SearchOperation = column.SearchToolBarOperation }; string str4 = (str2.Length > 0) ? str : ""; string str5 = ConstructLinqFilterExpression(grid, args); str2 = str2 + str4 + str5; } } return str2; }
public string RenderHtml(JQGrid grid) { string format = "<table id='{0}'></table>"; if (grid.ToolBarSettings.ToolBarPosition != ToolBarPosition.Hidden) { format = format + "<div id='{0}_pager'></div>"; } if (DateTime.Now > CompiledOn.CompilationDate.AddDays(45.0)) { return "This is a trial version of jqGrid for ASP.NET MVC which has expired.<br> Please, contact [email protected] for purchasing the product or for trial extension."; } if (string.IsNullOrEmpty(grid.ID)) { throw new Exception("You need to set ID for this grid."); } format = string.Format(format, grid.ID); if ((grid.HierarchySettings.HierarchyMode == HierarchyMode.Child) || (grid.HierarchySettings.HierarchyMode == HierarchyMode.ParentAndChild)) { return (format + this.GetChildSubGridJavaScript(grid)); } return (format + this.GetStartupJavascript(grid, false)); }
public GridDemo() { grid = new JQGrid() { Columns = new List<JQGridColumn>() { new JQGridColumn() { DataField="idPerfil", PrimaryKey=true, Editable=false, Width=(100) }, new JQGridColumn() { DataField="infraccion", Editable=true, Width=150 }, new JQGridColumn() { DataField="karma", Editable=true, Width=150 }, new JQGridColumn() { DataField="beneado", Editable=true, Width=150 } }, Width=Unit.Pixel(600) }; grid.ToolBarSettings.ShowRefreshButton = true; }
private string GetStartupOptions(JQGrid grid, bool subGrid) { StringBuilder builder = new StringBuilder(); string str = subGrid ? "jQuery('#' + subgrid_table_id)" : string.Format("jQuery('#{0}')", grid.ID); string str2 = subGrid ? "jQuery('#' + pager_id)" : string.Format("jQuery('#{0}')", grid.ID + "_pager"); string pagerSelectorID = subGrid ? "'#' + pager_id" : string.Format("'#{0}'", grid.ID + "_pager"); string str4 = subGrid ? "&parentRowID=' + row_id + '" : string.Empty; string str5 = (grid.DataUrl.IndexOf("?") > 0) ? "&" : "?"; string str6 = (grid.EditUrl.IndexOf("?") > 0) ? "&" : "?"; string str7 = string.Format("{0}{1}jqGridID={2}{3}", new object[] { grid.DataUrl, str5, grid.ID, str4 }); string str8 = string.Format("{0}{1}jqGridID={2}&editMode=1{3}", new object[] { grid.EditUrl, str6, grid.ID, str4 }); builder.AppendFormat("{0}.jqGrid({{", str); //tree if (grid.TreeGrid) { string str9 = grid.TreeGrid ? "true" : "false"; builder.AppendFormat("treeGrid:{0},treedatatype:'json',", str9); if (grid.TreeGridModel == TreeGridModel.adjacency) { builder.Append("treeGridModel: 'adjacency',"); } builder.AppendFormat("ExpandColumn: '{0}',", grid.ExpandColumn); builder.Append("ExpandColClick: 'true',"); //,level_field:'level',leaf_field:'isLeaf',expanded_field:'expanded' //builder.Append("treeReader:{parent_id_field:'" + grid.ParentIdField + "'},"); builder.Append("treeReader:{level_field:'level',parent_id_field:'parent_id','leaf_field':'isLeaf',expanded_field:'expanded'},"); } //end tree builder.AppendFormat("url: '{0}'", str7); builder.AppendFormat(",editurl: '{0}'", str8); if (grid.TreeGrid) { builder.AppendFormat(",mtype: 'POST'", new object[0]); } else { builder.AppendFormat(",mtype: 'GET'", new object[0]); } builder.AppendFormat(",datatype: 'json'", new object[0]); builder.AppendFormat(",page: {0}", grid.PagerSettings.CurrentPage); builder.AppendFormat(",colNames: {0}", this.GetColNames(grid)); builder.AppendFormat(",colModel: {0}", this.GetColModel(grid)); builder.AppendFormat(",viewrecords: true", new object[0]); builder.AppendFormat(",scrollrows: true", new object[0]); builder.AppendFormat(",prmNames: {{ id: \"{0}\" }}", Util.GetPrimaryKeyField(grid)); if (grid.AppearanceSettings.ShowFooter) { builder.Append(",footerrow: true"); builder.Append(",userDataOnFooter: true"); } if (!grid.AppearanceSettings.ShrinkToFit) { builder.Append(",shrinkToFit: false"); } if (grid.ColumnReordering) { builder.Append(",sortable: true"); } if (grid.AppearanceSettings.ScrollBarOffset != 0x12) { builder.AppendFormat(",scrollOffset: {0}", grid.AppearanceSettings.ScrollBarOffset); } if (grid.AppearanceSettings.RightToLeft) { builder.Append(",direction: 'rtl'"); } if (grid.AutoWidth) { builder.Append(",autowidth: true"); } if (!grid.ShrinkToFit) { builder.Append(",shrinkToFit: false"); } if ((grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Bottom) || (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom)) { builder.AppendFormat(",pager: {0}", str2); } if ((grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Top) || (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom)) { builder.Append(",toppager: true"); } if (grid.RenderingMode == RenderingMode.Optimized) { if (grid.HierarchySettings.HierarchyMode != HierarchyMode.None) { throw new Exception("Optimized rendering is not compatible with hierarchy."); } builder.Append(",gridview: true"); } if ((grid.HierarchySettings.HierarchyMode == HierarchyMode.Parent) || (grid.HierarchySettings.HierarchyMode == HierarchyMode.ParentAndChild)) { builder.Append(",subGrid: true"); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.SubGridRowExpanded)) { builder.AppendFormat(",subGridRowExpanded: {0}", grid.ClientSideEvents.SubGridRowExpanded); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.ServerError)) { builder.AppendFormat(",errorCell: {0}", grid.ClientSideEvents.ServerError); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.RowSelect)) { builder.AppendFormat(",onSelectRow: {0}", grid.ClientSideEvents.RowSelect); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.ColumnSort)) { builder.AppendFormat(",onSortCol: {0}", grid.ClientSideEvents.ColumnSort); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.RowDoubleClick)) { builder.AppendFormat(",ondblClickRow: {0}", grid.ClientSideEvents.RowDoubleClick); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.RowRightClick)) { builder.AppendFormat(",onRightClickRow: {0}", grid.ClientSideEvents.RowRightClick); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.LoadDataError)) { builder.AppendFormat(",loadError: {0}", grid.ClientSideEvents.LoadDataError); } else { builder.AppendFormat(",loadError: {0}", "jqGrid_aspnet_loadErrorHandler"); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.GridInitialized)) { builder.AppendFormat(",gridComplete: {0}", grid.ClientSideEvents.GridInitialized); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.BeforeAjaxRequest)) { builder.AppendFormat(",gridComplete: {0}", grid.ClientSideEvents.BeforeAjaxRequest); } if (!grid.AppearanceSettings.HighlightRowsOnHover) { builder.Append(",hoverrows: false"); } if (grid.AppearanceSettings.AlternateRowBackground) { builder.Append(",altRows: true"); } if (grid.AppearanceSettings.ShowRowNumbers) { builder.Append(",rownumbers: true"); } if (grid.AppearanceSettings.RowNumbersColumnWidth != 0x19) { builder.AppendFormat(",rownumWidth: {0}", grid.AppearanceSettings.RowNumbersColumnWidth.ToString()); } if (grid.PagerSettings.ScrollBarPaging) { builder.AppendFormat(",scroll: 1", new object[0]); } if (!grid.TreeGrid) { builder.AppendFormat(",rowNum: {0}", grid.PagerSettings.PageSize.ToString()); builder.AppendFormat(",rowList: {0}", grid.PagerSettings.PageSizeOptions.ToString()); } if (!string.IsNullOrEmpty(grid.PagerSettings.NoRowsMessage)) { builder.AppendFormat(",emptyrecords: '{0}'", grid.PagerSettings.NoRowsMessage.ToString()); } builder.AppendFormat(",editDialogOptions: {0}", this.GetEditOptions(grid)); builder.AppendFormat(",addDialogOptions: {0}", this.GetAddOptions(grid)); builder.AppendFormat(",delDialogOptions: {0}", this.GetDelOptions(grid)); builder.AppendFormat(",searchDialogOptions: {0}", this.GetSearchOptions(grid)); builder.AppendFormat(",jsonreader: {{ id: \"{0}\" }}", grid.Columns[Util.GetPrimaryKeyIndex(grid)].DataField); if (!string.IsNullOrEmpty(grid.SortSettings.InitialSortColumn)) { builder.AppendFormat(",sortname: '{0}'", grid.SortSettings.InitialSortColumn); } builder.AppendFormat(",sortorder: '{0}'", grid.SortSettings.InitialSortDirection.ToString().ToLower()); if (grid.MultiSelect) { builder.Append(",multiselect: true"); if (grid.MultiSelectMode == MultiSelectMode.SelectOnCheckBoxClickOnly) { builder.AppendFormat(",multiboxonly: true", grid.MultiSelect.ToString().ToLower()); } if (grid.MultiSelectKey != MultiSelectKey.None) { builder.AppendFormat(",multikey: '{0}'", this.GetMultiKeyString(grid.MultiSelectKey)); } } if (!string.IsNullOrEmpty(grid.AppearanceSettings.Caption)) { builder.AppendFormat(",caption: '{0}'", grid.AppearanceSettings.Caption); } if (!grid.Width.IsEmpty) { builder.AppendFormat(",width: '{0}'", grid.Width.ToString().Replace("px", "")); } if (!grid.Height.IsEmpty) { builder.AppendFormat(",height: '{0}'", grid.Height.ToString().Replace("px", "")); } if (grid.GroupSettings.GroupFields.Count > 0) { builder.Append(",grouping:true"); builder.Append(",groupingView: {"); builder.AppendFormat("groupField: ['{0}']", grid.GroupSettings.GroupFields[0].DataField); builder.AppendFormat(",groupColumnShow: [{0}]", grid.GroupSettings.GroupFields[0].ShowGroupColumn.ToString().ToLower()); builder.AppendFormat(",groupText: ['{0}']", grid.GroupSettings.GroupFields[0].HeaderText); builder.AppendFormat(",groupOrder: ['{0}']", grid.GroupSettings.GroupFields[0].GroupSortDirection.ToString().ToLower()); builder.AppendFormat(",groupSummary: [{0}]", grid.GroupSettings.GroupFields[0].ShowGroupSummary.ToString().ToLower()); builder.AppendFormat(",groupCollapse: {0}", grid.GroupSettings.CollapseGroups.ToString().ToLower()); builder.AppendFormat(",groupDataSorted: true", new object[0]); builder.Append("}"); } builder.AppendFormat(",viewsortcols: [{0},'{1}',{2}]", "false", grid.SortSettings.SortIconsPosition.ToString().ToLower(), (grid.SortSettings.SortAction == SortAction.ClickOnHeader) ? "true" : "false"); builder.AppendFormat("}})\r", new object[0]); builder.Append(this.GetToolBarOptions(grid, subGrid, pagerSelectorID)); builder.Append(this.GetLoadErrorHandler()); if (grid.ToolBarSettings.ShowSearchToolBar) { builder.AppendFormat("{0}.filterToolbar();", str); } //builder.AppendFormat("{0}.jqGrid('bindKeys');", str); return(builder.ToString()); }
internal static JsonTreeResponse PrepareJsonTreeResponse(JsonTreeResponse response, JQGrid grid, DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { response.rows[i] = new Hashtable(); for (int j = 0; j < grid.Columns.Count; j++) { JQGridColumn jQGridColumn = grid.Columns[j]; string value = ""; if (!string.IsNullOrEmpty(jQGridColumn.DataField)) { int ordinal = dt.Columns[jQGridColumn.DataField].Ordinal; value = (string.IsNullOrEmpty(jQGridColumn.DataFormatString) ? dt.Rows[i].ItemArray[ordinal].ToString() : jQGridColumn.FormatDataValue(dt.Rows[i].ItemArray[ordinal], jQGridColumn.HtmlEncode)); } response.rows[i].Add(jQGridColumn.DataField, value); } try { response.rows[i].Add("tree_level", dt.Rows[i]["tree_level"] as int?); } catch { } try { response.rows[i].Add("tree_parent", Convert.ToString(dt.Rows[i]["tree_parent"])); } catch { } try { response.rows[i].Add("tree_leaf", dt.Rows[i]["tree_leaf"] as bool?); } catch { } try { response.rows[i].Add("tree_expanded", dt.Rows[i]["tree_expanded"] as bool?); } catch { } try { response.rows[i].Add("tree_loaded", dt.Rows[i]["tree_loaded"] as bool?); } catch { } try { response.rows[i].Add("tree_icon", dt.Rows[i]["tree_icon"] as string); } catch { } } return(response); }
private static DataTable ObtainDataTableFromIEnumerable(IEnumerable ien, JQGrid grid) { DataTable table = new DataTable(); foreach (object obj2 in ien) { if (obj2 is DbDataRecord) { DbDataRecord record = obj2 as DbDataRecord; if (table.Columns.Count == 0) { foreach (JQGridColumn column in grid.Columns) { table.Columns.Add(column.DataField); } } DataRow row = table.NewRow(); foreach (JQGridColumn column2 in grid.Columns) { row[column2.DataField] = record[column2.DataField]; } table.Rows.Add(row); continue; } if (obj2 is DataRow) { DataRow row2 = obj2 as DataRow; if (table.Columns.Count == 0) { foreach (JQGridColumn column3 in grid.Columns) { table.Columns.Add(column3.DataField); } } DataRow row3 = table.NewRow(); foreach (JQGridColumn column4 in grid.Columns) { row3[column4.DataField] = row2[column4.DataField]; } table.Rows.Add(row3); continue; } PropertyInfo[] properties = obj2.GetType().GetProperties(); if (table.Columns.Count == 0) { foreach (PropertyInfo info in properties) { Type propertyType = info.PropertyType; if (propertyType.IsGenericType && (propertyType.GetGenericTypeDefinition() == typeof(Nullable<>))) { propertyType = Nullable.GetUnderlyingType(propertyType); } table.Columns.Add(info.Name, propertyType); } } DataRow row4 = table.NewRow(); foreach (PropertyInfo info2 in properties) { object obj3 = info2.GetValue(obj2, null); if (obj3 != null) { row4[info2.Name] = obj3; } else { row4[info2.Name] = DBNull.Value; } } table.Rows.Add(row4); } return table; }
public JsonAddDialog(JQGrid grid) { this._jsonValues = new Hashtable(); this._grid = grid; }
public static string GetPrimaryKeyField(JQGrid grid) { int primaryKeyIndex = Util.GetPrimaryKeyIndex(grid); return(grid.Columns[primaryKeyIndex].DataField); }
public JsonEditDialog(JQGrid grid) { this._json = new JavaScriptSerializer(); this._jsonValues = new Hashtable(); this._grid = grid; }
public JsonSearchToolBar(JQGrid grid) { this._jsonValues = new Hashtable(); this._grid = grid; }
private string GetDelOptions(JQGrid grid) { JsonDelDialog jsonDelDialog = new JsonDelDialog(grid); return(jsonDelDialog.Process()); }
private string GetSearchOptions(JQGrid grid) { JsonSearchDialog jsonSearchDialog = new JsonSearchDialog(grid); return(jsonSearchDialog.Process()); }
private string GetStartupOptions(JQGrid grid, bool subGrid) { StringBuilder stringBuilder = new StringBuilder(); string arg = subGrid ? "jQuery('#' + subgrid_table_id)" : string.Format("jQuery('#{0}')", grid.ID); string arg2 = subGrid ? "jQuery('#' + pager_id)" : string.Format("jQuery('#{0}')", grid.ID + "_pager"); string pagerSelectorID = subGrid ? "'#' + pager_id" : string.Format("'#{0}'", grid.ID + "_pager"); string text = subGrid ? "&parentRowID=' + row_id + '" : string.Empty; string text2 = (grid.DataUrl.IndexOf("?") > 0) ? "&" : "?"; string text3 = (grid.EditUrl.IndexOf("?") > 0) ? "&" : "?"; string arg3 = string.Format("{0}{1}jqGridID={2}{3}", new object[] { grid.DataUrl, text2, grid.ID, text }); string arg4 = string.Format("{0}{1}jqGridID={2}&editMode=1{3}", new object[] { grid.EditUrl, text3, grid.ID, text }); if (grid.Columns.Count > 0 && grid.Columns[0].Frozen) { grid.AppearanceSettings.ShrinkToFit = false; } stringBuilder.AppendFormat("{0}.jqGrid({{", arg); stringBuilder.AppendFormat("url: '{0}'", arg3); stringBuilder.AppendFormat(",loadui: '{0}'", grid.LoadUI); stringBuilder.AppendFormat(",editurl: '{0}'", arg4); stringBuilder.AppendFormat(",mtype: 'GET'", new object[0]); stringBuilder.AppendFormat(",datatype: '{0}'", grid.DataType); stringBuilder.AppendFormat(",page: {0}", grid.PagerSettings.CurrentPage); stringBuilder.AppendFormat(",colNames: {0}", this.GetColNames(grid)); stringBuilder.AppendFormat(",colModel: {0}", this.GetColModel(grid)); stringBuilder.AppendFormat(",viewrecords: true", new object[0]); stringBuilder.AppendFormat(",scrollrows: false", new object[0]); stringBuilder.AppendFormat(",prmNames: {{ id: \"{0}\" }}", Util.GetPrimaryKeyField(grid)); if (grid.AppearanceSettings.ShowFooter) { stringBuilder.Append(",footerrow: true"); stringBuilder.Append(",userDataOnFooter: true"); } if (!grid.AppearanceSettings.ShrinkToFit) { stringBuilder.Append(",shrinkToFit: false"); } if (grid.ColumnReordering) { stringBuilder.Append(",sortable: true"); } if (grid.AppearanceSettings.ScrollBarOffset != 18) { stringBuilder.AppendFormat(",scrollOffset: {0}", grid.AppearanceSettings.ScrollBarOffset); } if (grid.AppearanceSettings.RightToLeft) { stringBuilder.Append(",direction: 'rtl'"); } if (grid.AutoWidth) { stringBuilder.Append(",autowidth: true"); } if (!grid.ShrinkToFit) { stringBuilder.Append(",shrinkToFit: false"); } if (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Bottom || grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom) { stringBuilder.AppendFormat(",pager: {0}", arg2); } if (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Top || grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom) { stringBuilder.Append(",toppager: true"); } if (grid.RenderingMode == RenderingMode.Optimized) { if (grid.HierarchySettings.HierarchyMode != HierarchyMode.None) { throw new Exception("Optimized rendering is not compatible with hierarchy."); } stringBuilder.Append(",gridview: true"); } if (grid.HierarchySettings.HierarchyMode == HierarchyMode.Parent || grid.HierarchySettings.HierarchyMode == HierarchyMode.ParentAndChild) { stringBuilder.Append(",subGrid: true"); stringBuilder.AppendFormat(",subGridOptions: {0}", grid.HierarchySettings.ToJSON()); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.SubGridRowExpanded)) { stringBuilder.AppendFormat(",subGridRowExpanded: {0}", grid.ClientSideEvents.SubGridRowExpanded); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.ServerError)) { stringBuilder.AppendFormat(",errorCell: {0}", grid.ClientSideEvents.ServerError); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.RowSelect)) { stringBuilder.AppendFormat(",onSelectRow: {0}", grid.ClientSideEvents.RowSelect); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.ColumnSort)) { stringBuilder.AppendFormat(",onSortCol: {0}", grid.ClientSideEvents.ColumnSort); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.RowDoubleClick)) { stringBuilder.AppendFormat(",ondblClickRow: {0}", grid.ClientSideEvents.RowDoubleClick); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.RowRightClick)) { stringBuilder.AppendFormat(",onRightClickRow: {0}", grid.ClientSideEvents.RowRightClick); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.LoadDataError)) { stringBuilder.AppendFormat(",loadError: {0}", grid.ClientSideEvents.LoadDataError); } else { stringBuilder.AppendFormat(",loadError: {0}", "jqGrid_aspnet_loadErrorHandler"); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.GridInitialized)) { stringBuilder.AppendFormat(",gridComplete: {0}", grid.ClientSideEvents.GridInitialized); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.BeforeAjaxRequest)) { stringBuilder.AppendFormat(",beforeRequest: {0}", grid.ClientSideEvents.BeforeAjaxRequest); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.AfterAjaxRequest)) { stringBuilder.AppendFormat(",loadComplete: {0}", grid.ClientSideEvents.AfterAjaxRequest); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.SerializeGridData)) { stringBuilder.AppendFormat(",serializeGridData:{0}", grid.ClientSideEvents.SerializeGridData); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.SerializeRowData)) { stringBuilder.AppendFormat(",serializeRowData:{0}", grid.ClientSideEvents.SerializeRowData); } if (grid.TreeGridSettings.Enabled) { stringBuilder.AppendFormat(",treeGrid: true", new object[0]); stringBuilder.AppendFormat(",treedatatype: 'json'", new object[0]); stringBuilder.AppendFormat(",treeGridModel: 'adjacency'", new object[0]); string arg5 = "{ level_field: 'tree_level', parent_id_field: 'tree_parent', leaf_field: 'tree_leaf', expanded_field: 'tree_expanded', loaded: 'tree_loaded', icon_field: 'tree_icon' }"; stringBuilder.AppendFormat(",treeReader: {0}", arg5); stringBuilder.AppendFormat(",ExpandColumn: '{0}'", this.GetFirstVisibleDataField(grid)); Hashtable hashtable = new Hashtable(); if (!string.IsNullOrEmpty(grid.TreeGridSettings.CollapsedIcon)) { hashtable.Add("plus", grid.TreeGridSettings.CollapsedIcon); } if (!string.IsNullOrEmpty(grid.TreeGridSettings.ExpandedIcon)) { hashtable.Add("minus", grid.TreeGridSettings.ExpandedIcon); } if (!string.IsNullOrEmpty(grid.TreeGridSettings.LeafIcon)) { hashtable.Add("leaf", grid.TreeGridSettings.LeafIcon); } if (hashtable.Count > 0) { stringBuilder.AppendFormat(",treeIcons: {0}", new JavaScriptSerializer().Serialize(hashtable)); } } if (!grid.AppearanceSettings.HighlightRowsOnHover) { stringBuilder.Append(",hoverrows: false"); } if (grid.AppearanceSettings.AlternateRowBackground) { stringBuilder.Append(",altRows: true"); } if (grid.AppearanceSettings.ShowRowNumbers) { stringBuilder.Append(",rownumbers: true"); } if (grid.AppearanceSettings.RowNumbersColumnWidth != 25) { stringBuilder.AppendFormat(",rownumWidth: {0}", grid.AppearanceSettings.RowNumbersColumnWidth.ToString()); } if (grid.PagerSettings.ScrollBarPaging) { stringBuilder.AppendFormat(",scroll: 1", new object[0]); } stringBuilder.AppendFormat(",rowNum: {0}", grid.PagerSettings.PageSize.ToString()); stringBuilder.AppendFormat(",rowList: {0}", grid.PagerSettings.PageSizeOptions.ToString()); //stringBuilder.Append(",recordpos:left"); if (!string.IsNullOrEmpty(grid.PagerSettings.NoRowsMessage)) { stringBuilder.AppendFormat(",emptyrecords: '{0}'", grid.PagerSettings.NoRowsMessage.ToString()); } stringBuilder.AppendFormat(",editDialogOptions: {0}", this.GetEditOptions(grid)); stringBuilder.AppendFormat(",addDialogOptions: {0}", this.GetAddOptions(grid)); stringBuilder.AppendFormat(",delDialogOptions: {0}", this.GetDelOptions(grid)); stringBuilder.AppendFormat(",searchDialogOptions: {0}", this.GetSearchOptions(grid)); string format; if (grid.TreeGridSettings.Enabled) { format = ",jsonReader: {{ id: \"{0}\", repeatitems:false,subgrid:{{repeatitems:false}} }}"; } else { format = ",jsonReader: {{ id: \"{0}\" }}"; } stringBuilder.AppendFormat(format, grid.Columns[Util.GetPrimaryKeyIndex(grid)].DataField); if (!string.IsNullOrEmpty(grid.SortSettings.InitialSortColumn)) { stringBuilder.AppendFormat(",sortname: '{0}'", grid.SortSettings.InitialSortColumn); } stringBuilder.AppendFormat(",sortorder: '{0}'", grid.SortSettings.InitialSortDirection.ToString().ToLower()); if (grid.MultiSelect) { stringBuilder.Append(",multiselect: true"); if (grid.MultiSelectMode == MultiSelectMode.SelectOnCheckBoxClickOnly) { stringBuilder.AppendFormat(",multiboxonly: true", grid.MultiSelect.ToString().ToLower()); } if (grid.MultiSelectKey != MultiSelectKey.None) { stringBuilder.AppendFormat(",multikey: '{0}'", this.GetMultiKeyString(grid.MultiSelectKey)); } } if (!string.IsNullOrEmpty(grid.AppearanceSettings.Caption)) { stringBuilder.AppendFormat(",caption: '{0}'", grid.AppearanceSettings.Caption); } if (!grid.Width.IsEmpty) { stringBuilder.AppendFormat(",width: '{0}'", grid.Width.ToString().Replace("px", "")); } if (!grid.Height.IsEmpty) { stringBuilder.AppendFormat(",height: '{0}'", grid.Height.ToString().Replace("px", "")); } if (grid.GroupSettings.GroupFields.Count > 0) { stringBuilder.Append(",grouping:true"); stringBuilder.Append(",groupingView: {"); stringBuilder.AppendFormat("groupField: ['{0}']", grid.GroupSettings.GroupFields[0].DataField); stringBuilder.AppendFormat(",groupColumnShow: [{0}]", grid.GroupSettings.GroupFields[0].ShowGroupColumn.ToString().ToLower()); stringBuilder.AppendFormat(",groupText: ['{0}']", grid.GroupSettings.GroupFields[0].HeaderText); stringBuilder.AppendFormat(",groupOrder: ['{0}']", grid.GroupSettings.GroupFields[0].GroupSortDirection.ToString().ToLower()); stringBuilder.AppendFormat(",groupSummary: [{0}]", grid.GroupSettings.GroupFields[0].ShowGroupSummary.ToString().ToLower()); stringBuilder.AppendFormat(",groupCollapse: {0}", grid.GroupSettings.CollapseGroups.ToString().ToLower()); stringBuilder.AppendFormat(",groupDataSorted: true", new object[0]); stringBuilder.Append("}"); } stringBuilder.AppendFormat(",viewsortcols: [{0},'{1}',{2}]", "false", grid.SortSettings.SortIconsPosition.ToString().ToLower(), (grid.SortSettings.SortAction == SortAction.ClickOnHeader) ? "true" : "false"); stringBuilder.AppendFormat("}})\r", new object[0]); stringBuilder.Append(this.GetToolBarOptions(grid, subGrid, pagerSelectorID)); if (!grid.PagerSettings.ScrollBarPaging) { stringBuilder.AppendFormat(".bindKeys()", new object[0]); } if (grid.Columns.Count > 0 && grid.Columns[0].Frozen) { stringBuilder.AppendFormat(".setFrozenColumns()", new object[0]); } stringBuilder.Append(";"); stringBuilder.Append(this.GetLoadErrorHandler()); stringBuilder.Append(";"); if (grid.HeaderGroups.Count > 0) { List <Hashtable> list = new List <Hashtable>(); foreach (JQGridHeaderGroup current in grid.HeaderGroups) { list.Add(current.ToHashtable()); } stringBuilder.AppendFormat("{0}.setGroupHeaders( {{ useColSpanStyle:true,groupHeaders:{1} }});", arg, new JavaScriptSerializer().Serialize(list)); } if (grid.ToolBarSettings.ShowSearchToolBar) { stringBuilder.AppendFormat("{0}.filterToolbar({1});", arg, new JsonSearchToolBar(grid).Process()); } return(stringBuilder.ToString()); }
private string GetEditOptions(JQGrid grid) { JsonEditDialog jsonEditDialog = new JsonEditDialog(grid); return(jsonEditDialog.Process()); }
public static string RemoveQuotesForJavaScriptMethods(string input, JQGrid grid) { string text = input; foreach (JQGridColumn current in grid.Columns) { if (current.Formatter != null) { JQGridColumnFormatter formatter = current.Formatter; if (formatter is CustomFormatter) { CustomFormatter customFormatter = (CustomFormatter)formatter; string oldValue = string.Format("\"formatter\":\"{0}\"", customFormatter.FormatFunction); string newValue = string.Format("\"formatter\":{0}", customFormatter.FormatFunction); text = text.Replace(oldValue, newValue); oldValue = string.Format("\"unformat\":\"{0}\"", customFormatter.UnFormatFunction); newValue = string.Format("\"unformat\":{0}", customFormatter.UnFormatFunction); text = text.Replace(oldValue, newValue); } } foreach (JQGridEditClientSideValidator current2 in current.EditClientSideValidators) { if (current2 is CustomValidator) { CustomValidator customValidator = (CustomValidator)current2; string oldValue2 = string.Format("\"custom_func\":\"{0}\"", customValidator.ValidationFunction); string newValue2 = string.Format("\"custom_func\":{0}", customValidator.ValidationFunction); text = text.Replace(oldValue2, newValue2); } } if (current.EditType == EditType.Custom) { string oldValue3 = string.Format("\"custom_element\":\"{0}\"", current.EditTypeCustomCreateElement); string newValue3 = string.Format("\"custom_element\":{0}", current.EditTypeCustomCreateElement); text = text.Replace(oldValue3, newValue3); oldValue3 = string.Format("\"custom_value\":\"{0}\"", current.EditTypeCustomGetValue); newValue3 = string.Format("\"custom_value\":{0}", current.EditTypeCustomGetValue); text = text.Replace(oldValue3, newValue3); } if (current.Editable && ( current.EditType == EditType.DatePicker || current.EditType == EditType.DateTimePicker || current.EditType == EditType.TimePicker || current.EditType == EditType.AutoComplete || current.EditType == EditType.Chosen)) { string attachEditorsFunction = GridUtil.GetAttachEditorsFunction(grid, current.EditType.ToString().ToLower(), current.EditorControlID); text = text.Replace(string.Concat(new object[] { '"', "attachEditControlsScript", current.DataField, '"' }), attachEditorsFunction); } if (current.Searchable && (current.SearchType == SearchType.DatePicker || current.SearchType == SearchType.AutoComplete || current.SearchType == SearchType.DateTimePicker || current.SearchType == SearchType.TimePicker)) { string attachEditorsFunction2 = GridUtil.GetAttachEditorsFunction(grid, current.SearchType.ToString().ToLower(), current.SearchControlID); text = text.Replace(string.Concat(new object[] { '"', "attachSearchControlsScript", current.DataField, '"' }), attachEditorsFunction2); } if (current.DataEvents.Count > 0) { List <DataEvent> lde = current.DataEvents.FindAll(f => f.Type != DataEventType.No); if (lde.Count > 0) { foreach (DataEvent de in lde) { string oldValue = string.Format("\"fn\":\"{0}\"", de.Function); string newValue = string.Format("\"fn\":{0}", de.Function); text = text.Replace(oldValue, newValue); } } } if (!string.IsNullOrEmpty(current.DataUrl)) { string oldValue = string.Format("\"dataUrl\":\"{0}\"", current.DataUrl); string newValue = string.Format("\"dataUrl\":{0}", current.DataUrl); text = text.Replace(oldValue, newValue); } if (!string.IsNullOrEmpty(current.BuildSelect)) { string oldValue = string.Format("\"buildSelect\":\"{0}\"", current.BuildSelect); string newValue = string.Format("\"buildSelect\":{0}", current.BuildSelect); text = text.Replace(oldValue, newValue); } if (!string.IsNullOrEmpty(current.SerializeColumnData)) { string oldValue = string.Format("\"postData\":\"{0}\"", current.SerializeColumnData); string newValue = string.Format("\"postData\":{0}", current.SerializeColumnData); text = text.Replace(oldValue, newValue); } if (!string.IsNullOrEmpty(current.DataInit)) { string oldValue = string.Format("\"dataInit\":\"{0}\"", current.DataInit); string newValue = string.Format("\"dataInit\":{0}", current.DataInit); text = text.Replace(oldValue, newValue); } //if (!string.IsNullOrEmpty(current.Complete)) //{ // string oldValue = string.Format("\"complete\":\"{0}\"", current.Complete); // string newValue = string.Format("\"complete\":{0}", current.Complete); // text = text.Replace(oldValue, newValue); //} if (current.EditActionIconsColumn) { if (current.EditActionIconsSettings.ShowEditIcon && !string.IsNullOrEmpty(current.EditActionIconsSettings.onEdit)) { string oldValue = string.Format("\"onEdit\":\"{0}\"", current.EditActionIconsSettings.onEdit); string newValue = string.Format("\"onEdit\":{0}", current.EditActionIconsSettings.onEdit); text = text.Replace(oldValue, newValue); } if (current.EditActionIconsSettings.ShowDeleteIcon) { if (!string.IsNullOrEmpty(current.EditActionIconsSettings.DelErrorTextFormat)) { string oldValue = string.Format("\"errorTextFormat\":\"{0}\"", current.EditActionIconsSettings.DelErrorTextFormat); string newValue = string.Format("\"errorTextFormat\":{0}", current.EditActionIconsSettings.DelErrorTextFormat); text = text.Replace(oldValue, newValue); } if (!string.IsNullOrEmpty(grid.ClientSideEvents.SerializeDelData)) { string oldValue = string.Format("\"serializeDelData\":\"{0}\"", grid.ClientSideEvents.SerializeDelData); string newValue = string.Format("\"serializeDelData\":{0}", grid.ClientSideEvents.SerializeDelData); text = text.Replace(oldValue, newValue); } } } } text = text.Replace('"' + "dataInit" + '"', "dataInit"); return(text); }
public JsonColModel(JQGridColumn column, JQGrid grid) : this(grid) { this.FromColumn(column); }
public JsonColModel(JQGrid grid) { this._jsonValues = new Hashtable(); this._grid = grid; }
private string GetAddOptions(JQGrid grid) { JsonAddDialog dialog = new JsonAddDialog(grid); return(dialog.Process()); }
private string GetExcelExportOptions(JQGrid grid) { JsonExcelExport jsonGridExport = new JsonExcelExport(grid); return(jsonGridExport.Process()); }
public JsonAddDialog(JQGrid grid) { this._grid = grid; }
public JsonEditDialog(JQGrid grid) { this._grid = grid; }
public JsonDelDialog(JQGrid grid) { this._grid = grid; }
public JQGridDataResolvedEventArgs(JQGrid gridModel, IQueryable currentData, IQueryable allData) { this._currentData = currentData; this._allData = allData; this._gridModel = gridModel; }
internal static string ConvertToJsonString(JsonResponse response, JQGrid grid, DataTable dt) { return(new JavaScriptSerializer().Serialize(PrepareJsonResponse(response, grid, dt))); }
private static DataTable ObtainDataTableFromIEnumerable(IEnumerable ien, JQGrid grid) { DataTable dataTable = new DataTable(); foreach (object current in ien) { if (current is DbDataRecord) { DbDataRecord dbDataRecord = current as DbDataRecord; if (dataTable.Columns.Count == 0) { foreach (JQGridColumn current2 in grid.Columns) { dataTable.Columns.Add(current2.DataField); } } DataRow dataRow = dataTable.NewRow(); foreach (JQGridColumn current3 in grid.Columns) { dataRow[current3.DataField] = dbDataRecord[current3.DataField]; } dataTable.Rows.Add(dataRow); } else { if (current is DataRow) { DataRow dataRow2 = current as DataRow; if (dataTable.Columns.Count == 0) { foreach (JQGridColumn current4 in grid.Columns) { dataTable.Columns.Add(current4.DataField); } } DataRow dataRow3 = dataTable.NewRow(); foreach (JQGridColumn current5 in grid.Columns) { dataRow3[current5.DataField] = dataRow2[current5.DataField]; } dataTable.Rows.Add(dataRow3); } else { Type type = current.GetType(); PropertyInfo[] properties = type.GetProperties(); if (dataTable.Columns.Count == 0) { PropertyInfo[] array = properties; for (int i = 0; i < array.Length; i++) { PropertyInfo propertyInfo = array[i]; Type type2 = propertyInfo.PropertyType; if (type2.IsGenericType && type2.GetGenericTypeDefinition() == typeof(Nullable <>)) { type2 = Nullable.GetUnderlyingType(type2); } dataTable.Columns.Add(propertyInfo.Name, type2); } } DataRow dataRow4 = dataTable.NewRow(); PropertyInfo[] array2 = properties; for (int j = 0; j < array2.Length; j++) { PropertyInfo propertyInfo2 = array2[j]; object value = propertyInfo2.GetValue(current, null); if (value != null) { dataRow4[propertyInfo2.Name] = value; } else { dataRow4[propertyInfo2.Name] = DBNull.Value; } } dataTable.Rows.Add(dataRow4); } } } return(dataTable); }
public JsonSearchDialog(JQGrid grid) { this._grid = grid; }
public JsonExcelExport(JQGrid grid) { this._jsonValues = new Hashtable(); this._grid = grid; }