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
NR
Nirmal Raja
Syncfusion Team
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
GC
Grant Crofton
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.
MA
Mahendran
Syncfusion Team
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.
GC
Grant Crofton
February 14, 2011 09:59 AM UTC
Excellent, that's even better. Thanks a lot.
Grant
MA
Mahendran
Syncfusion Team
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