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.
Unfortunately, activation email could not send to your email. Please try again.

Allow grouping but not column reordering

Thread ID:

Created:

Updated:

Platform:

Replies:

98097 Feb 3,2011 11:34 AM Feb 15,2011 01:04 AM Windows Forms 5
loading
Tags: Grouping
Grant Crofton
Asked On February 3, 2011 11:34 AM

Hi, I'd like to prevent users from re-ordering the columns (by dragging the headers around), but allow grouping by dragging column headers into the grouping row.

I tried setting:

requestGrid.TableDescriptor.TableOptions.AllowDragColumns = False

but that prevents both. Is there something I can set to prevent only column ordering, or some event to cancel?

I'm using GridGroupingControl v4.402.0.51

Thanks,
Grant


Nirmal Raja [Syncfusion]
Replied On February 7, 2011 03:57 AM

Hi Grant,

Thank you for your interest in Syncfusion products.

You can use the following event and the code hooked to the event to disable the column on reordering the position, but allow to group through drag and drop.

gridGroupingControl1.TableControl.QueryAllowDragColumn += new Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowDragColumnEventHandler(TableControl_QueryAllowDragColumn);
void TableControl_QueryAllowDragColumn(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowDragColumnEventArgs e)
{
if (e.Reason == Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowDragColumnReason.MouseUp)
e.AllowDrag = false;
}


Let me know if you have any concern.

Regards,
Nirmal


Grant Crofton
Replied On February 8, 2011 07:24 AM

That works, thanks. It isn't ideal as it still looks like the user can reorder the columns by dragging, but it gets around our main problem.


Mahendran [Syncfusion]
Replied On February 13, 2011 10:41 PM

Hi Grant,

Thanks for your update.

To prevent the user can redorder the column by dragging you need to handle the QueryAllowDragColumn Event handler. We have modified the already given code. Please refer the following code.


void TableControl_QueryAllowDragColumn(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowDragColumnEventArgs e)
{
if (e.Reason == Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowDragColumnReason.MouseUp || e.Reason==Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowDragColumnReason.ShowRedArrowIndicator )
e.AllowDrag = false;
}


Please let me know if you have any concerns.

Regards
R.Mahendran.




Grant Crofton
Replied On February 14, 2011 04:59 AM

Excellent, that's even better. Thanks a lot.

Grant


Mahendran [Syncfusion]
Replied On February 15, 2011 01:04 AM

Hi Grant,

Thanks for using Syncfusion products.

Please let me know if you have any concerns.

Regards
R.Mahendran


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;