Remove GridView GroupPanel close [x]

3 posts, 1 answers
  1. Daniel
    Daniel avatar
    17 posts
    Member since:
    Oct 2013

    Posted 07 Nov 2014 Link to this post

         Hello, How can I remove the Close icon in GridView GroupPanel see attached image. I just want to use the sorting function of the group column or any work around to enable the user to sort the group.


    thanks in advance.
  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3204 posts

    Posted 12 Nov 2014 Link to this post

    Hello Daniel,

    Thank you for writing.

    When you drag a certain column and drop it onto the GroupPanelElement, the grid data is grouped by this column. Each GroupFieldElement shows a close button by which you can remove the specific GroupDescriptor. Clicking over the GroupFieldElement changes the groups sort order (ascending or descending). Please refer to the attached SortGrouping.gif file. In order to hide the close button, you should subscribe to the GroupByChanged and set the RemoveButton.Visibility property to false for each GroupFieldElement:
    private void radGridView1_GroupByChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
    {
        if (this.radGridView1.GridViewElement.GroupPanelElement.PanelContainer.Children != null &&
            this.radGridView1.GridViewElement.GroupPanelElement.PanelContainer.Children.Count > 0)
        {
            TemplateGroupsElement templateGroupsElement = radGridView1.GridViewElement.GroupPanelElement.PanelContainer.Children[0] as TemplateGroupsElement;
            if (templateGroupsElement != null)
            {
                foreach (GroupElement groupElement in templateGroupsElement.GroupElements)
                {
                    foreach (GroupFieldElement groupFieldsElement in groupElement.GroupingFieldElements)
                    {
                        if (groupFieldsElement.RemoveButton.Visibility == ElementVisibility.Visible)
                        {
                            groupFieldsElement.RemoveButton.Visibility = ElementVisibility.Collapsed;
                        }
                    }
                }
            }
        }
    }

    Note that in this case in order to remove the GroupDescriptor, you should drag the GroupFieldElement and drop it between the grid header cells. This behavior is demonstrated on the attached RemoveGrouping.gif file.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Daniel
    Daniel avatar
    17 posts
    Member since:
    Oct 2013

    Posted 13 Nov 2014 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thank you very much Desislava. This is very helpful.
Back to Top