Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/28/14 12:52:24 (10 years ago)
Author:
sbreuer
Message:
  • deleted unused method
  • refactored filter logic
  • added filter changed event
  • changed datagridview validation (cannot modify, if filter is active)
  • update datagridview if preview is active
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs

    r10898 r10900  
    9696      base.RegisterContentEvents();
    9797      Content.Changed += Content_Changed;
    98     }
     98      Content.FilterLogic.FilterChanged += FilterLogic_FilterChanged;
     99    }
     100
     101    void FilterLogic_FilterChanged(object sender, EventArgs e) {
     102      OnContentChanged();
     103      searchIterator = null;
     104    }   
    99105
    100106    protected override void DeregisterContentEvents() {
    101107      base.DeregisterContentEvents();
    102108      Content.Changed -= Content_Changed;
     109      Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
    103110    }
    104111
     
    121128      if (!dataGridView.ReadOnly) {
    122129        string errorMessage;
    123         if (Content != null && !Content.DataGridLogic.Validate(e.FormattedValue.ToString(), out errorMessage, e.ColumnIndex)) {
    124           e.Cancel = true;
    125           dataGridView.Rows[e.RowIndex].ErrorText = errorMessage;
     130        if (Content != null){
     131          if (dataGridView.IsCurrentCellInEditMode && Content.FilterLogic.IsFiltered()) {
     132            errorMessage = "A filter is active, you cannot modify data. Press ESC to exit edit mode.";
     133          } else {
     134            Content.DataGridLogic.Validate(e.FormattedValue.ToString(), out errorMessage, e.ColumnIndex);
     135          }
     136
     137          if (!String.IsNullOrEmpty(errorMessage)) {
     138            e.Cancel = true;
     139            dataGridView.Rows[e.RowIndex].ErrorText = errorMessage;
     140          }
    126141        }
    127142      }
Note: See TracChangeset for help on using the changeset viewer.