GridViewGroupRow persistence on data refresh

3 posts, 0 answers
  1. Diptimaya
    Diptimaya avatar
    9 posts
    Member since:
    Aug 2012

    Posted 23 Jan 2012 Link to this post

    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. Alexander
    Alexander avatar
    10 posts
    Member since:
    Jun 2009

    Posted 05 Sep 2013 Link to this post

    Hi,

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

    Cheers,
    Alexander
  3. DevCraft banner
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 05 Sep 2013 Link to this post

    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 >>
Back to Top