private void Build_ColumnsRows() { int insertCounter1 = this.TotalCoumnsInUI_Min - jF2(".ColumnsRow").length; if (insertCounter1 > 0) { for (int i = 0; i < insertCounter1; i++) { this.AddEmptyColumnToUI(0, true, null); } } int insertCounter2 = this.TotalCoumnsInUI_MinEmpty - this.HowManyBottomColumnsAreEmpty(); if (insertCounter2 > 0) { for (int i = 0; i < insertCounter2; i++) { this.AddEmptyColumnToUI(0, true, null); } } this.ColumnsRows = new ColumnsRow[0]; var elements = jF2(".ColumnsRow"); for (int i = 0; i < elements.length; i++) { this.ColumnsRows[i] = ColumnsRow.Get_UIObject(elements[i]); this.ColumnsRows[i].ColumnPosition_Property = i + 1; } }
public void PositionChanged_ViaTextBox(ColumnsRow columnsRow) { columnsRow.jRoot.detach(); int old_Position = columnsRow.Model.OrdinalPosition; int new_Position = columnsRow.ColumnPosition_Property; if (new_Position < 1) { new_Position = 1; } if (new_Position > old_Position) { new_Position++; } int index_ToInsertBefore = new_Position - 1; if (index_ToInsertBefore < this.ColumnsRows.Length) { columnsRow.jRoot.insertBefore(this.ColumnsRows[index_ToInsertBefore].jRoot); } else { columnsRow.ColumnPosition_Property = this.ColumnsRows.Length + 1; columnsRow.jRoot.insertAfter(this.ColumnsRows[this.ColumnsRows.Length - 1].jRoot); } this.Build_ColumnsRows(); this.EnableSaveBttn(); }
//-------------------------------------------------------------------------------------- CSS & HTML -- public new static string GetCssTree() { string rtn = ""; rtn += GetCssRoot(); rtn += ColumnsRow.GetCssTree(); return(rtn); }
//------------------------------------------------------------------------------------------ Events -- public void OnInsertBefore(ColumnsRow columnsRow) { var new_ColumnsRow = this.AddEmptyColumnToUI(columnsRow.ColumnPosition_Property, false, columnsRow.jRoot); this.Build_ColumnsRows(); this.EnableSaveBttn(); }
private void Instantiate_AndAttachEvents(ColumnsRow columnsRow) { columnsRow.Instantiate(); columnsRow.OnInsertBefore.After.AddHandler(this, "OnInsertBefore", 1); columnsRow.OnRequestRemove.After.AddHandler(this, "OnRequestRemove", 1); columnsRow.OnColumnPositionChange.After.AddHandler(this, "PositionChanged_ViaTextBox", 1); columnsRow.OnGotoTab.After.AddHandler(this, "OnGotoTab_Method", 1); columnsRow.OnColumnNameBlur.After.AddHandler(this, "OnColumnNameBlur_Method", 0); columnsRow.OnChange.After.AddHandler(this, "OnColumnsRowChange", 0); columnsRow.OnUpOrDownArrow.After.AddHandler(this, "OnColumn_UpOrDownArrow", 2); }
//---------------------------------------------------------------------------------------------------- public static ColumnsRow Get_UIObject(HtmlElement htmlElement) { ColumnsRow rtn = null; try { eval("rtn = htmlElement.UIObject;"); } catch { } return(rtn); }
public void PositionChanged_ViaMouse(object jQ_Event, object ui) { var elements = jF2(".ColumnsRow"); for (int i = 0; i < elements.length; i++) { int new_ColumnPosition = i + 1; var columnsRow = ColumnsRow.Get_UIObject(elements[i]); if (columnsRow != null) { columnsRow.ColumnPosition_Property = new_ColumnPosition; } } this.Build_ColumnsRows(); this.EnableSaveBttn(); }
private int HowManyBottomColumnsAreEmpty() { int rtn = 0; var elements = jF2(".ColumnsRow"); for (int i = elements.length - 1; i >= 0; i--) { var columnsRow = ColumnsRow.Get_UIObject(elements[i]); if (JsStr.S(columnsRow.ColumnName_Property).Trim().String.Length < 1) { rtn++; } else { i = -1; // end loop; } } return(rtn); }
//---------------------------------------------------------------------------------------------------- private ColumnsRow AddEmptyColumnToUI(int columnPosition, bool insertAtBottom, jQuery or_InsertBeforeThisElement) { var rtn = new ColumnsRow(new Column(), this.ViewModel); rtn.Model.OrdinalPosition = columnPosition; rtn.Model.ChangeAction = Column.ChangeActionTypes.Add; this.Instantiate_AndAttachEvents(rtn); if (insertAtBottom) { jF2(".Holder_ColumnRows").append(rtn.jRoot); } else { rtn.jRoot.insertBefore(or_InsertBeforeThisElement); } return(rtn); }
public void OnRequestRemove(ColumnsRow columnsRow) { columnsRow.jRoot.detach(); this.Build_ColumnsRows(); this.EnableSaveBttn(); }