///<summary> /// GridDataBindingStartEventArgs ///</summary> ///<param name="gridPanel">Associated GridPanel</param> ///<param name="row">Associated GridRow</param> ///<param name="tableName">Name of table being bound to</param> ///<param name="autoGenerateColumns">Whether to auto-generate columns</param> ///<param name="crProcess"></param> public GridDataBindingStartEventArgs(GridPanel gridPanel, GridRow row, string tableName, bool autoGenerateColumns, ProcessChildRelations crProcess) : base(gridPanel, row) { _TableName = tableName; _AutoGenerateColumns = autoGenerateColumns; _ProcessChildRelations = crProcess; }
/// <summary> /// Handles invocation of DataBindingStart events /// </summary> internal bool DoDataBindingStartEvent(GridPanel gridPanel, GridRow row, string tableName, ref bool autogen, ref ProcessChildRelations crProcess) { if (DataBindingStart != null) { GridDataBindingStartEventArgs ev = new GridDataBindingStartEventArgs(gridPanel, row, tableName, autogen, crProcess); DataBindingStart(this, ev); autogen = ev.AutoGenerateColumns; crProcess = ev.ProcessChildRelations; return (ev.Cancel); } return (false); }
internal void AddDataTable( DataTable dt, bool autogen, ProcessChildRelations crProcess) { if (SetDataConnection(dt) == true) { if (CurrencyManager != null) { CurrencyManager.ListChanged -= CmDataSetListChanged; CurrencyManager.ListChanged += CmDataSetListChanged; if (autogen == true) AutoGenerateColumns(dt); if (_Panel.VirtualMode == false) { int pindex = (crProcess != ProcessChildRelations.Never) ? GetPrimaryColumnIndex(dt) : -1; bool rowsUnresolved = (pindex >= 0 && dt.ChildRelations.Count > 0); for (int i = 0; i < CurrencyManager.Count; i++) { DataRowView view = CurrencyManager.List[i] as DataRowView; if (view != null) { GridRow row = GetNewRow(dt, view); row.DataItem = view; row.DataItemIndex = i; row.RowsUnresolved = rowsUnresolved; _Panel.Rows.Add(row); } } if (rowsUnresolved == true) { _Panel.PrimaryColumnIndex = pindex; _Panel.ShowTreeButtons = true; _Panel.ShowTreeLines = true; _Panel.SuperGrid.BeforeExpand -= SuperGridBeforeExpand; _Panel.SuperGrid.BeforeExpand += SuperGridBeforeExpand; } } else { dt.DefaultView.RowFilter = ""; } UpdateSuperGridSort(false); _Panel.SuperGrid.DoDataBindingCompleteEvent(_Panel); } } }