We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Keep GridDataControl state when Filter Clear button is pressed

Thread ID:

Created:

Updated:

Platform:

Replies:

124612 Jun 17,2016 07:34 AM UTC Jun 20,2016 12:57 PM UTC WPF 1
loading
Tags: GridDataControl
Volker Holz
Asked On June 17, 2016 07:34 AM UTC

We have activated the FilterBar for our GridDataControl. The GDC contains Child-Grids.

When we enter a filter and than press the cler filter button in the bottom line, two things happen:

- The complete grid collapses
- SortColumnsChanging events which have been added to the table of the child grid are no longer there?

How can I prevent all this from happening, all I want is reset the filter.

I couldn't even find an event which fires, when the reset happens. I tried all Loaded, Unloaded, Changed and similar events I could find on the Grid, the Model and the Child's model.

Please help on this topic.

Jai Ganesh S [Syncfusion]
Replied On June 20, 2016 12:57 PM UTC

Hi Volker, 
 
Query 1: 
 
You can achieve your requirement for maintaining the grid state when we apply and clear the filter by using FilterChanging and FilterChanged event like below, 
 
dataGrid.Model.FilterChanging += Model_FilterChanging; 
dataGrid.Model.FilterChanged += Model_FilterChanged; 
 
 
    void Model_FilterChanged(object sender, GridFilterEventArgs e) 
        { 
            foreach (var gdr in ExpandedRecords) 
            { 
                var recordIndex = this.dataGrid.Model.View.Records.IndexOfRecord((gdr as GridDataRecord).Data); 
 
                if (recordIndex > 0) 
                    (this.dataGrid.Model.View.Records[recordIndex] as GridDataRecord).IsDetailsViewExpanded = true; 
            } 
        } 
 
        void Model_FilterChanging(object sender, Syncfusion.Windows.Controls.Grid.GridFilterEventArgs e) 
        { 
            ExpandedRecords = new List<GridDataRecord>(); 
            var s = dataGrid.Model.View.Records; 
            foreach (var gdr in dataGrid.Model.View.Records) 
            { 
                var record = gdr as GridDataRecord;                 
                if (record.IsDetailsViewExpanded) 
                    ExpandedRecords.Add(record); 
            } 
        } 
 
 
Query 2: (SortColumnsChanging events which have been added to the table of the child grid are no longer there
 
Could you please let us know, in which event inside you have wired the SortColumnsChanging event of DetailsView ? 
 
Regards, 
Jai Ganesh S 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;