public void DisableFilter(DataGridViewColumn Column) { if (!this.Columns.Contains(Column)) { return; } ADGVColumnHeaderCell headerCell = Column.HeaderCell as ADGVColumnHeaderCell; if (headerCell != null) { if (headerCell.FilterEnabled && (headerCell.SortString.Length > 0 || headerCell.FilterString.Length > 0)) { this.ClearFilter(true); headerCell.FilterEnabled = false; } else { headerCell.FilterEnabled = false; } this.filterOrder.Remove(Column.Name); this.sortOrder.Remove(Column.Name); this.readyToShowFilters.Remove(Column.Name); } Column.SortMode = DataGridViewColumnSortMode.Automatic; }
private String CreateSortString() { StringBuilder sb = new StringBuilder(""); foreach (string name in this.sortOrder) { DataGridViewColumn column = this.Columns[name]; if (column != null) { ADGVColumnHeaderCell cell = column.HeaderCell as ADGVColumnHeaderCell; if (cell != null && cell.ActiveSortType != ADGVSortType.None) { sb.AppendFormat(cell.SortString + ", ", column.DataPropertyName); } } } if (sb.Length > 2) { sb.Length -= 2; } return(sb.ToString()); }
public void ClearFilter(bool fireEvent = false, DataGridViewColumn column = null) { if (column == null) { foreach (ADGVColumnHeaderCell c in this.filterCells) { c.ClearFilter(); } this.filterOrder.Clear(); } else if (this.Columns.Contains(column)) { ADGVColumnHeaderCell cell = column.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { cell.ClearFilter(); this.filterOrder.Remove(column.Name); } } if (fireEvent) { this.FilterString = null; } else { this.filterString = null; } }
public void Remove(ADGVColumnHeaderCell cell) { if (cell != null && cell.OwningColumn != null) { this.Remove(cell.OwningColumn.DataPropertyName); } }
private String CreateSortString() { StringBuilder sb = new StringBuilder(""); String appx = ""; foreach (String name in this.sortOrder) { DataGridViewColumn Column = this.Columns[name]; if (Column != null) { ADGVColumnHeaderCell cell = Column.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { if (cell.FilterEnabled && cell.ActiveSortType != ADGVFilterMenuSortType.None) { sb.AppendFormat(appx + cell.SortString, Column.DataPropertyName); appx = ", "; } } } } return(sb.ToString()); }
public ADGVColumnHeaderCell(DataGridViewColumnHeaderCell oldCell, Boolean FilterEnabled = false) { this.Tag = oldCell.Tag; this.ErrorText = oldCell.ErrorText; this.ToolTipText = oldCell.ToolTipText; this.Value = oldCell.Value; this.ValueType = oldCell.ValueType; this.ContextMenuStrip = oldCell.ContextMenuStrip; this.Style = oldCell.Style; this.filterEnabled = FilterEnabled; ADGVColumnHeaderCell oldADGVCell = oldCell as ADGVColumnHeaderCell; if (oldADGVCell != null && oldADGVCell.FilterMenu != null) { this.FilterMenu = oldADGVCell.FilterMenu; this.filterImage = oldADGVCell.filterImage; this.filterButtonPressed = oldADGVCell.filterButtonPressed; this.filterButtonOver = oldADGVCell.filterButtonOver; this.filterButtonOffsetBounds = oldADGVCell.filterButtonOffsetBounds; this.filterButtonImageBounds = oldADGVCell.filterButtonImageBounds; this.FilterMenu.FilterChanged += new EventHandler(FilterMenu_FilterChanged); this.FilterMenu.SortChanged += new EventHandler(FilterMenu_SortChanged); } else { this.FilterMenu = new ADGVFilterMenu(oldCell.OwningColumn.ValueType); this.FilterMenu.FilterChanged += new EventHandler(FilterMenu_FilterChanged); this.FilterMenu.SortChanged += new EventHandler(FilterMenu_SortChanged); } }
public void Add(ADGVColumnHeaderCell cell) { if (cell != null && cell.OwningColumn != null) { this.RemoveAll(r => r.DataPropertyName == cell.OwningColumn.DataPropertyName); this.Add(new ADGVFilterRecord(cell.OwningColumn.DataPropertyName, cell.FilterString, cell.ActiveFilterType)); } }
public void EnableFilter(DataGridViewColumn Column) { if (this.Columns.Contains(Column)) { ADGVColumnHeaderCell c = Column.HeaderCell as ADGVColumnHeaderCell; if (c != null) { this.EnableFilter(Column, c.DateWithTime, c.TimeFilter); } else { this.EnableFilter(Column, this.DateWithTime, this.TimeFilter); } } }
protected override void OnColumnRemoved(DataGridViewColumnEventArgs e) { this.readyToShowFilters.Remove(e.Column.Name); this.filterOrder.Remove(e.Column.Name); this.sortOrder.Remove(e.Column.Name); ADGVColumnHeaderCell headerCell = e.Column.HeaderCell as ADGVColumnHeaderCell; if (headerCell != null) { headerCell.SortChanged -= new ADGVFilterEventHandler(this.eSortChanged); headerCell.FilterChanged -= new ADGVFilterEventHandler(this.eFilterChanged); headerCell.FilterPopup -= new ADGVFilterEventHandler(this.eFilterPopup); } base.OnColumnRemoved(e); }
protected override void OnColumnRemoved(DataGridViewColumnEventArgs e) { this.readyToShowFilters.Remove(e.Column.Name); this.filterOrder.Remove(e.Column.Name); this.sortOrder.Remove(e.Column.Name); ADGVColumnHeaderCell cell = e.Column.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { cell.SortChanged -= eSortChanged; cell.FilterChanged -= eFilterChanged; cell.FilterPopup -= eFilterPopup; } base.OnColumnRemoved(e); }
public void EnableFilter(DataGridViewColumn Column) { if (!this.Columns.Contains(Column)) { return; } ADGVColumnHeaderCell headerCell = Column.HeaderCell as ADGVColumnHeaderCell; if (headerCell != null) { this.EnableFilter(Column, headerCell.DateWithTime, headerCell.TimeFilter); } else { this.EnableFilter(Column, this.DateWithTime, this.TimeFilter); } }
protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { e.Column.SortMode = DataGridViewColumnSortMode.Programmatic; ADGVColumnHeaderCell cell = new ADGVColumnHeaderCell(e.Column.HeaderCell, this.DefaultCellBehavior); cell.SortChanged += new ADGVFilterEventHandler(eSortChanged); cell.FilterChanged += new ADGVFilterEventHandler(eFilterChanged); cell.FilterPopup += new ADGVFilterEventHandler(eFilterPopup); cell.DateTimeGrouping = this.DefaultDateTimeGrouping; e.Column.MinimumWidth = cell.MinimumSize.Width; if (this.ColumnHeadersHeight < cell.MinimumSize.Height) { this.ColumnHeadersHeight = cell.MinimumSize.Height; } e.Column.HeaderCell = cell; base.OnColumnAdded(e); }
protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { e.Column.SortMode = DataGridViewColumnSortMode.Programmatic; ADGVColumnHeaderCell columnHeaderCell = new ADGVColumnHeaderCell(e.Column.HeaderCell, this.AutoGenerateContextFilters); columnHeaderCell.DateWithTime = this.DateWithTime; columnHeaderCell.TimeFilter = this.TimeFilter; columnHeaderCell.SortChanged += new ADGVFilterEventHandler(this.eSortChanged); columnHeaderCell.FilterChanged += new ADGVFilterEventHandler(this.eFilterChanged); columnHeaderCell.FilterPopup += new ADGVFilterEventHandler(this.eFilterPopup); e.Column.MinimumWidth = columnHeaderCell.MinimumSize.Width; if (this.ColumnHeadersHeight < columnHeaderCell.MinimumSize.Height) { this.ColumnHeadersHeight = columnHeaderCell.MinimumSize.Height; } e.Column.HeaderCell = (DataGridViewColumnHeaderCell)columnHeaderCell; base.OnColumnAdded(e); }
private string CreateSortString() { StringBuilder stringBuilder = new StringBuilder(""); string str = ""; foreach (string index in this.sortOrder) { DataGridViewColumn column = this.Columns[index]; if (column != null) { ADGVColumnHeaderCell headerCell = column.HeaderCell as ADGVColumnHeaderCell; if (headerCell != null && headerCell.FilterEnabled && headerCell.ActiveSortType != ADGVFilterMenuSortType.None) { stringBuilder.AppendFormat(str + headerCell.SortString, (object)column.DataPropertyName); str = ", "; } } } return(stringBuilder.ToString()); }
public void SetFilterBehavior(ADGVColumnHeaderCellBehavior behavior, DataGridViewColumn column = null) { if (column == null) { foreach (DataGridViewColumn c in this.Columns) { ADGVColumnHeaderCell cell = c.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { cell.CellBehavior = behavior; } } } else if (this.Columns.Contains(column)) { ADGVColumnHeaderCell cell = column.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { cell.CellBehavior = behavior; } } }
public void SetFilterDateTimeGrouping(ADGVFilterMenuDateTimeGrouping grouping, DataGridViewColumn column = null) { if (column == null) { foreach (DataGridViewColumn c in this.Columns) { ADGVColumnHeaderCell cell = c.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { cell.DateTimeGrouping = grouping; } } } else if (this.Columns.Contains(column)) { ADGVColumnHeaderCell cell = column.HeaderCell as ADGVColumnHeaderCell; if (cell != null) { cell.DateTimeGrouping = grouping; } } }
public ADGVColumnHeaderCell(DataGridViewColumnHeaderCell oldCell, ADGVColumnHeaderCellBehavior cellBehavior) { this.Tag = oldCell.Tag; this.ErrorText = oldCell.ErrorText; this.ToolTipText = oldCell.ToolTipText; this.Value = oldCell.Value; this.ValueType = oldCell.ValueType; this.ContextMenuStrip = oldCell.ContextMenuStrip; this.Style = oldCell.Style; this.cellBehavior = cellBehavior; ADGVColumnHeaderCell oldADGVCell = oldCell as ADGVColumnHeaderCell; if (oldADGVCell != null) { if (oldADGVCell.FilterMenu != null) { this.FilterMenu = oldADGVCell.FilterMenu.Clone() as ADGVFilterMenu; } else { this.FilterMenu = new ADGVFilterMenu(oldCell.OwningColumn.ValueType); } this.filterButtonPressed = oldADGVCell.filterButtonPressed; this.filterButtonOver = oldADGVCell.filterButtonOver; this.filterButtonOffsetBounds = oldADGVCell.filterButtonOffsetBounds; this.filterButtonImageBounds = oldADGVCell.filterButtonImageBounds; } else { this.FilterMenu = new ADGVFilterMenu(oldCell.OwningColumn.ValueType); } this.FilterMenu.FilterChanged += FilterMenu_FilterChanged; this.FilterMenu.SortChanged += FilterMenu_SortChanged; this.FilterMenu.DateTimeGroupingChanged += FilterMenu_DateTimeGroupingChanged; }
public void EnableFilter(DataGridViewColumn Column, bool DateWithTime, bool TimeFilter) { if (!this.Columns.Contains(Column)) { return; } ADGVColumnHeaderCell headerCell = Column.HeaderCell as ADGVColumnHeaderCell; if (headerCell != null) { if (headerCell.DateWithTime != DateWithTime || headerCell.TimeFilter != TimeFilter || !headerCell.FilterEnabled && (headerCell.FilterString.Length > 0 || headerCell.SortString.Length > 0)) { this.ClearFilter(true); } headerCell.DateWithTime = DateWithTime; headerCell.TimeFilter = TimeFilter; headerCell.FilterEnabled = true; this.readyToShowFilters.Remove(Column.Name); } else { Column.SortMode = DataGridViewColumnSortMode.Programmatic; ADGVColumnHeaderCell columnHeaderCell = new ADGVColumnHeaderCell(Column.HeaderCell, true); columnHeaderCell.DateWithTime = this.DateWithTime; columnHeaderCell.TimeFilter = this.TimeFilter; columnHeaderCell.SortChanged += new ADGVFilterEventHandler(this.eSortChanged); columnHeaderCell.FilterChanged += new ADGVFilterEventHandler(this.eFilterChanged); columnHeaderCell.FilterPopup += new ADGVFilterEventHandler(this.eFilterPopup); Column.MinimumWidth = columnHeaderCell.MinimumSize.Width; if (this.ColumnHeadersHeight < columnHeaderCell.MinimumSize.Height) { this.ColumnHeadersHeight = columnHeaderCell.MinimumSize.Height; } Column.HeaderCell = (DataGridViewColumnHeaderCell)columnHeaderCell; } Column.SortMode = DataGridViewColumnSortMode.Programmatic; }
private String CreateFilterString() { StringBuilder sb = new StringBuilder(""); foreach (string name in this.filterOrder) { DataGridViewColumn column = this.Columns[name]; if (column != null) { ADGVColumnHeaderCell cell = column.HeaderCell as ADGVColumnHeaderCell; if (cell != null && cell.ActiveFilterType != ADGVFilterType.None) { sb.AppendFormat("(" + cell.FilterString + ") AND ", column.DataPropertyName); } } } if (sb.Length > 4) { sb.Length -= 4; } return(sb.ToString()); }