//---------------------------------------------------------------------------------------------------- public void Refresh(bool disable) { if (disable) { jF("select").attr("disabled", "disabled").addClass("SelectGrayed"); } else { jF("select").removeAttr("disabled").removeClass("SelectGrayed"); } var leftSelect = jF(".Select_Column_ForeignKey"); var rightSelect = jF(".Select_Column_PrimaryKey"); leftSelect.html("<option value=''></option>"); rightSelect.html("<option value=''></option>"); var otherTable = this.ViewModel.TableStructure_TempOtherTable; var thisTable = this.ViewModel.TableStructure; if (this.RelationshipSide == ForeignKeysEdit.RelationshipSides.Inbound) { // Left - Other Table if (otherTable != null) { for (int i = 0; i < otherTable.Columns.Length; i++) { leftSelect.append(JsStr.StrFormat2("<option value='{0}'>{1}</option>", otherTable.Columns[i].ColumnName, otherTable.Columns[i].ColumnName)); } } // Right - This Table for (int i = 0; i < thisTable.Columns.Length; i++) { rightSelect.append(JsStr.StrFormat2("<option value='{0}'>{1}</option>", thisTable.Columns[i].ColumnName, thisTable.Columns[i].ColumnName)); } } else if (this.RelationshipSide == ForeignKeysEdit.RelationshipSides.Outbound) { // Left - This Table for (int i = 0; i < thisTable.Columns.Length; i++) { leftSelect.append(JsStr.StrFormat2("<option value='{0}'>{1}</option>", thisTable.Columns[i].ColumnName, thisTable.Columns[i].ColumnName)); } // Right - Other Table if (otherTable != null) { for (int i = 0; i < otherTable.Columns.Length; i++) { rightSelect.append(JsStr.StrFormat2("<option value='{0}'>{1}</option>", otherTable.Columns[i].ColumnName, otherTable.Columns[i].ColumnName)); } } } if (!this.IsNew) { jF(".Select_Column_ForeignKey").val(this.Model.ForeignKey_ColumnName); jF(".Select_Column_PrimaryKey").val(this.Model.PrimaryKey_ColumnName); } }
//---------------------------------------------------------------------------------------------------- public void Instantiate_Sub() { jRoot = J("<div class='SectionBox jRoot'>"); jRoot.append(this.GetHtmlRoot()); if (this.Model != null && this.Model.IsOpen) { jF2(".SectionLinks").show(); } var holder = jF2(".SectionLinks").html(""); if (this.Model != null && this.Model.Items != null) { string previousSchema = ""; int schemasCount = 0; for (int i = 0; i < this.Model.Items.Length; i++) { if (previousSchema != this.Model.Items[i].Schema) { previousSchema = this.Model.Items[i].Schema; schemasCount++; } } previousSchema = ""; for (int i = 0; i < this.Model.Items.Length; i++) { var itemInfo = this.Model.Items[i]; if (schemasCount > 1) { if (previousSchema != itemInfo.Schema) { holder.append("<div class='Schema' title='Schema: [" + itemInfo.Schema + "]'>" + itemInfo.Schema + "</div>"); } } previousSchema = itemInfo.Schema; holder.append(JsStr.StrFormat2("<a href='{0}'>{1}</a>", itemInfo.URL, itemInfo.Name)); } } this.BindUI(); }