//---------------------------------------------------------------------------------------------------- public void Instantiate_Sub() { this.jRoot = J("<tr class='RowUI jRoot'>"); this.jRoot.append(this.GetHtmlRoot()); if (this.IsOdd) { this.jRoot.addClass("RowUI_Alt"); } for (int i = 0; i < this.Model.Values.Length; i++) { string value = this.Model.Values[i]; if (this.ViewModel.TableType == GridRequest.TableTypes.View) { if (value.Length > 100) { value = st.New(value).TruncateRight(value.Length - 99).TheString + "..."; } } this.jRoot.append(JsStr.StrFormat1("<td>{0}</td>", value)); } if (this.ViewModel.TableType == GridRequest.TableTypes.Table) { jF(".Bttn_Open").attr("href", "#00-Record-" + this.Model.UniqueKey); } else { jF(".Bttn_Open").hide(); jF(".Bttn_Open2").show(); } var thisObj = this; var jRootObj = this.jRoot; eval(@" jRootObj.find('td').click(function() { thisObj.Td_Clicked(this); }); jRootObj.find('td').dblclick(function() { thisObj.Td_DoubleClicked(this); }); "); }
public void GetGrid_Return(ASPdb.Ajax.AjaxResponse response) { if (UI.Errors.ExceptionHandler.Check(response)) { if (response.Error.Message == "Invalid FilterField." && !this.LastAttemptWas_InvalidFilterField) { this.LastAttemptWas_InvalidFilterField = true; this.ViewModel.FilterAndSort = new FilterAndSort(); this.ViewModel.FilterAndSort.FilterFields = new ViewOptions_FilterField[0]; this.ViewModel.FilterAndSort.SortFields = new ViewOptions_SortField[0]; this.ViewOptions.BttnClick_ApplyAndRefresh(); } else { return; } } this.LastAttemptWas_InvalidFilterField = false; if (this.RecordViewerUI != null) { this.RecordViewerUI = null; } this.Model = response.ReturnObj.As <GridResponse>(); document.title = "[" + this.Model.TableName + "] - ASPdatabase.NET"; if (this.ViewModel.FilterAndSort.FilterFields != null && this.ViewModel.FilterAndSort.FilterFields.Length > 0) { this.GridToolBar.SetFilterCount(this.ViewModel.FilterAndSort.FilterFields.Length); } else if (this.ViewModel.FilterAndSort.SortFields != null && this.ViewModel.FilterAndSort.SortFields.Length > 0) { this.GridToolBar.SetFilterCount(0); } else { this.GridToolBar.SetFilterCount(-1); } this.ViewModel.SelectionCount = 0; this.ViewModel.AllColumnNames = new string[0]; for (int i = 0; i < this.Model.HeaderItems.Length; i++) { this.ViewModel.AllColumnNames[i] = this.Model.HeaderItems[i].FieldName; } this.BindUI(); this.GridToolBar.Model = this.Model; this.GridToolBar.Open(); var tableGridTable = jF(".TableGridTable").html(""); string headerHTML = "<tr>" + "<th class='SelectAllBox' title='Select/Deselect All'><span></span></th>" + "<th></th>"; for (int i = 0; i < this.Model.HeaderItems.Length; i++) { headerHTML += JsStr.StrFormat1("<th>{0}</th>", this.Model.HeaderItems[i].FieldName); } headerHTML += "</tr>"; tableGridTable.html(headerHTML); var thisObj = this; var jRootObj = this.jRoot; eval("jRootObj.find('.SelectAllBox').click(function(){ thisObj.SelectAllBox_Click(); });"); this.RowUIs = new RowUI[0]; for (int i = 0; i < this.Model.Rows.Length; i++) { this.RowUIs[i] = new RowUI(); this.RowUIs[i].IsOdd = (i % 2 == 1); this.RowUIs[i].ViewModel = this.ViewModel; this.RowUIs[i].Model = this.Model.Rows[i]; this.RowUIs[i].Model.DisplayIndex = i; this.RowUIs[i].OnSelection.After.AddHandler(this, "RowUI_OnSelection", 0); this.RowUIs[i].OnOpenViewer.After.AddHandler(this, "RowUI_OnOpenViewer", 1); this.RowUIs[i].Instantiate(); tableGridTable.append(this.RowUIs[i].jRoot); } UI.PagesFramework.BasePage.WindowResized(); }