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. Image for the cookie policy date

How to Remove a Column from Visible Columns Collection by Dragging its Column Header from GridGroupingControl

Hi,

We want to Remove a Column from Visible Columns Collection by Dragging its Column Header out of the GridGroupingControl.

Please let me know how we can do that.

Regards
Vijay

4 Replies

AD Administrator Syncfusion Team December 12, 2006 12:35 AM UTC

Hi Vijay,

If you want to remove a column from the VisiblColumns collection, when the column is dragged to the griddroparea, then try the code below in the TableDescriptor.GroupedColumns.Changing event handler. This will help in hiding the column when its dragged to the dragdroparea and reshow it again once its being detached from group.

private void GroupedColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
SortColumnDescriptor scd = e.Item as SortColumnDescriptor;
if(e.Action == Syncfusion.Collections.ListPropertyChangedType.Remove)
{
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add(scd.Name);
}
else if(e.Action == Syncfusion.Collections.ListPropertyChangedType.Insert)
{
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove(scd.Name);
}
}

Please try the attached sample that demontrates this.
Here is a sample GGC_GroupColumns.zip
Let us know if this is not what you needed.
Regards,
Rajagopal


VK Vijaya Kumar Reddy December 12, 2006 10:13 AM UTC

Hi,

The solution you have given is to group by that column and to hide that column when it is grouped. This is not the solution I expected.

I dont want to group by that column but want to remove that column when we drag that column header outside the Grid Control bounding area. A simple example is removing the column from the outlook inbox by dragging it away from the column header row. I want the equivalent functionality like this.

Regards
Vijay


AD Administrator Syncfusion Team December 12, 2006 12:30 PM UTC

Hi Vijay,

Here is a small sample that shows you "How to remove the column by dragging its Column Header out of the grid". It uses the TableControl.MouseUp event to remove the columns from the Grid. Please try the attached sample and let me know if you are looking something different.

Sample : GGC_GroupColumns.zip

Best Regards,
Haneef


VK Vijaya Kumar Reddy December 12, 2006 01:49 PM UTC

Hi,

Thanks for the sample. It works fine.

I made changes not to remove that column when it is getting groped by dropping it to the GroupDropArea. Also when we rearrange the columns.

Regards
Vijay

Loader.
Live Chat Icon For mobile
Up arrow icon