public virtual void ControlFiltering(Object sender, GridViewFilteringEventArgs e)
        {
            UIControlFilterList = ((GridViewDataControl)sender).FilterDescriptors;

            if (ObservedFieldFilters.Count > UIControlFilterList.Count)
            {
                IList <TelerikFieldFilterDescriptor> toDelete = new List <TelerikFieldFilterDescriptor>();
                foreach (TelerikFieldFilterDescriptor fieldFilter in ObservedFieldFilters)
                {
                    if (!fieldFilter.IsActive)
                    {
                        toDelete.Add(fieldFilter);
                    }
                }
                foreach (TelerikFieldFilterDescriptor fieldFilter in toDelete)
                {
                    if (ObservedFieldFilters.Remove(fieldFilter))
                    {
                        fieldFilter.PropertyChanged -= fieldFilterHasChangedDelegate;
                    }
                }
            }

            // If only the logical operator of a FieldFilter is changed, then no Filtering event is fired
            // => Changes in the FieldFilters must be tracked in addition
            if (e.ColumnFilterDescriptor.IsActive && e.ColumnFilterDescriptor.FieldFilter != null)
            {
                if (!ObservedFieldFilters.Contains(e.ColumnFilterDescriptor.FieldFilter))
                {
                    ObservedFieldFilters.Add(e.ColumnFilterDescriptor.FieldFilter);
                    e.ColumnFilterDescriptor.FieldFilter.PropertyChanged += fieldFilterHasChangedDelegate;
                }
            }

            AmbethIFilterDescriptor tempDescriptor = FilterDescriptorConverter.ConvertTelerikFilterCollection(UIControlFilterList);

            if (e.ColumnFilterDescriptor.IsActive == false && e.Added.Count <TelerikIFilterDescriptor>() > 0)
            {
                AmbethFilterDescriptor = this.FilterDescriptorConverter.AddTelerikFilterDescriptor(tempDescriptor, ((IList <TelerikIFilterDescriptor>)e.Added)[0]);
                return;
            }
            AmbethFilterDescriptor = tempDescriptor;
        }
 protected virtual void FieldFilterHasChanged(Object sender, PropertyChangedEventArgs e)
 {
     AmbethFilterDescriptor = FilterDescriptorConverter.ConvertTelerikFilterCollection(UIControlFilterList);
 }
Exemplo n.º 3
0
 public virtual void ControlFiltering(Object sender, NotifyCollectionChangedEventArgs e)
 {
     AmbethFilterDescriptor = FilterDescriptorConverter.ConvertTelerikFilterCollection(((RadDataFilter)sender).FilterDescriptors);
 }