How to get Filter String when filter changed for Excel Filter
Is there a built in way to get the filter string for a GridGroupingControl using an GridExcelFilter when filtering either by check boxes OR custom filter?
This is the string I expect for a multi column filter
([col1name] in ('val1-1', 'val1-2', 'val1-3', 'val1-4')) AND ([col2name] in ('val2-1', 'val2-2', 'val2-3', 'val2-4')) AND ([col3] LIKE '%val3%')
What I'm also noticing is that the check box filter and custom filters do not raise the same events. Is there a single event for any type of filter?
SIGN IN To post a reply.
3 Replies
AR
Arulpriya Ramalingam
Syncfusion Team
December 1, 2017 09:35 AM UTC
Hi David,
Thanks for contacting Syncfusion support.
As per the GridGroupingControl architecture, the RecordFilteres.Changed event will trigger for the RecordFilter and the RecordFiltersItemChanged event will trigger for the ExcelFilter(CheckBox filter). We regret to let you know that the GridGroupingControl does not have a common event to trigger for both filters (i.e. RecordFilter and ExcelFilter) and to retrieve the filter expression. Moreover, you can retrieve the filtered records from the FilteredRecords collection. Please refer to the below KB links to retrieve the filtered records and to know more about the events of filtering,
KB links: https://www.syncfusion.com/kb/6271/how-to-get-the-filtered-records-from-gridgroupingcontrol
Regards,
Arulpriya
DA
David
December 5, 2017 04:55 PM UTC
My original question wasn't answered - Is there a built in way to get the filter string for a GridGroupingControl using an GridExcelFilter when filtering either by check boxes OR custom filter?
AR
Arulpriya Ramalingam
Syncfusion Team
December 6, 2017 05:04 PM UTC
Hi David,
Thanks for your update.
We have analyzed your requirement and regret to let you know that the GridGroupingControl does not have the support to get the FilterString/Expression when the records are filtered by CheckBox options of GridExcelFilter. However, the RecordFiltersChanged event will trigger for the CustomFilters on GridExcelFilter and the Expression of filtered records can be retrieved from the RecordFilters collection by using the Expression property. Please refer to the below code and sample,
Code example
|
//Event Triggering
this.gridGroupingControl1.TableDescriptor.RecordFilters.Changed += RecordFilters_Changed;
//Event Customization
private void RecordFilters_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if (this.gridGroupingControl1.TableDescriptor.RecordFilters.Count > 0)
{
foreach (RecordFilterDescriptor recordFilter in gridGroupingControl1.TableDescriptor.RecordFilters)
{
string expression = recordFilter.Expression;
MessageBox.Show(expression);
}
}
} |
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/RecordFilters1395194021
Please let us know if you have any other queries.
Regards,
Arulpriya
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DA David
- Nov 30, 2017 06:36 PM UTC
- Dec 6, 2017 05:04 PM UTC