This is a migrated thread and some comments may be shown as answers.

GridViewGroupRow persistence on data refresh

2 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Diptimaya
Top achievements
Rank 1
Diptimaya asked on 23 Jan 2012, 09:33 AM
Hi Team,

I have this specific requirement where, on data refresh the expanded GridViewGroupRow has to be persisted. I have tried the persistence framework for this, which didn't work.

I tried getting the expanded group rows on event GroupRowIsExpandedChanged; I was successful in getting the expanded rows.

To expand the group rows; I tried using ChildrenOfType<GridViewGroupRow>; which gives the count always zero (even the grid is grouped).

Is there any event for GridViewGroupGroupRow Loaded; where I could check the distinct group row and expand it?

Or do you have a better solution?

Thanks

2 Answers, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 05 Sep 2013, 11:43 AM
Hi,

has there been any progress on this issue? We have exactly the same problem...

Cheers,
Alexander
0
Dimitrina
Telerik team
answered on 05 Sep 2013, 02:27 PM
Hi,

To achieve your goal, first of all you need to store all expanded groups - RadGridView.GroupRowIsExpanded is the perfect event for that. I have pasted a sample code below although it is not the "full" solution, since one group could be expanded and collapsed several times. You will need to handle all the possible cases.

public MainPage()
{
    InitializeComponent();
    this.radGridView.GroupRowIsExpandedChanged += newEventHandler<Telerik.Windows.Controls.GridView.GroupRowEventArgs>(radGridView_GroupRowIsExpandedChanged);
}
   
List<object> expandedGroups = new List<object>();
   
void radGridView_GroupRowIsExpandedChanged(object sender, Telerik.Windows.Controls.GridView.GroupRowEventArgs e)
{
    if (e.Row.IsExpanded)
    {
        this.expandedGroups.Add(e.Row.Group.Key);
    }
}

Then, based on the values you have saved in the expandedGroups collection, you should expand each group with the GridView.ExpandGroup method. This should be done after the data has been reloaded.

Please try this approach and let me know if you have met any problems.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Diptimaya
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or