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.
Syncfusion Feedback

Allow grouping but not column reordering

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 08:57 AM UTC

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 12:24 PM UTC

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 14, 2011 03:41 AM UTC

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 09:59 AM UTC

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

Grant


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

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.

Warning Icon 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.Close Icon

;