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
close icon

ColsMoved event doesn''t fire for GridGroupingControl

Hi,

I'm using Syncfusion 4.2, and I realize that TableModel.ColsMoved event doesn't fire for GridGroupingControl. And TableDescriptor.Columns.Changed event doesn't fire either when a column is moved.

Can someone please give me some suggestion, as I really need to find out the positions from/to which the columns are moved.

Thanks very much,
Frank

5 Replies

AD Administrator Syncfusion Team November 9, 2006 09:56 AM UTC

Hi,

Try handling the TableDescriptor.VisibleColumns.Changed event to detect the column changes in a grouping grid. Please try this and let me know if this helps.

Best Regards,
Haneef


AD Administrator Syncfusion Team November 9, 2006 01:44 PM UTC

yep, this works. Thanks.

>Hi,

Try handling the TableDescriptor.VisibleColumns.Changed event to detect the column changes in a grouping grid. Please try this and let me know if this helps.

Best Regards,
Haneef


AD Administrator Syncfusion Team November 9, 2006 02:50 PM UTC

Well, I don't seem to be able to cancel this event. I tried e.Cancel = true in both VisibleColumns.Changed and VisibleColumns.Changing events. Any suggestions?
Thank you.
Frank


AD Administrator Syncfusion Team November 9, 2006 02:50 PM UTC

Well, I don't seem to be able to cancel this event. I tried e.Cancel = true in both VisibleColumns.Changed and VisibleColumns.Changing events. Any suggestions?
Thank you.
Frank


AD Administrator Syncfusion Team November 10, 2006 06:09 AM UTC

Hi Frank,

One way you can do this is to handle a Changed event on the VisibleColumns collection and once again move the moved column items. You can handle the Changing event to find the Starting Index of the moving column on the grid. Here is a code snippet to show this.

//To subscribe the VisibleColumns.Changing event in Form.Load event
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Changing +=new ListPropertyChangedEventHandler(VisibleColumns_Changing);

int iStartIndex = -1;
private void VisibleColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
//Find the Starting Index of the moving column
//If you want to do this in any one of the particular column(index) then you need to check e.Index == YourIndex.
iStartIndex = e.Index;
GridVisibleColumnDescriptorCollection columns = sender as GridVisibleColumnDescriptorCollection ;
columns.Changed +=new Syncfusion.Collections.ListPropertyChangedEventHandler(VisibleColumns_Changed);
}

private void VisibleColumns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if( e.Action == ListPropertyChangedType.Move )
{
//unsubscribe the VisibleColumn event. to avoid the stack overflow except
GridVisibleColumnDescriptorCollection columns = sender as GridVisibleColumnDescriptorCollection ;
columns.Changed -=new ListPropertyChangedEventHandler(VisibleColumns_Changed);
columns.Changing -=new ListPropertyChangedEventHandler(VisibleColumns_Changing);

//Move the VisibleColumn once again..
columns.Move(e.Index,iStartIndex);

//subscribe the VisibleColumn.Changing event
columns.Changing +=new ListPropertyChangedEventHandler(VisibleColumns_Changing);
}
}

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon