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.

Sorting and Drag&Drop columns

Thread ID:

Created:

Updated:

Platform:

Replies:

15683 Jun 24,2004 11:45 AM Jun 25,2004 04:31 PM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 24, 2004 11:45 AM

Hi, I am using the GridControlSort example. I uncomment the line this.gridControl1.AllowSelection = GridSelectionFlags.Any & ~GridSelectionFlags.Column; in the Form1_Load method for column drag & drop purpose. Sorting doesn''t work all the time when I click on the column header. The column re-ording cursor shows up as well. My second problem is I want list mode selection. If I have this on, than I can select a column and hence can not re-order columns.

Administrator [Syncfusion]
Replied On June 24, 2004 12:04 PM

If you want to move columns using the default grid support for moving columns, then the columns have to be selectable. So you will have to add the columns flag back to the AllowSelections property to do this. If you do this, you could use a double click to sort, and a single click to select the column for moving. In this case, to get ListBoxSelectionMode to work with column moving, you will have to explicitly select the column when you click on it. (The reason is that listboxbox mode tells teh grid ot only select rows. SO, if you want a column selected so you can move it, you have to explicitly select it.) private void gridControl1_CellClick(object sender, GridCellClickEventArgs e) { //use this code to try to handle column selections with ListBoxSelectionMode set if(e.ColIndex > 0 && e.RowIndex == 0) { this.gridControl1.Selections.Add(GridRangeInfo.Col(e.ColIndex)); } } Now if you want to drag a column without first selecting it, check out this forum thread. It contains a sample. (You still will have to decide when a click is for moving the column or for sorting if you want to try to sort on a single click). http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9676

Administrator [Syncfusion]
Replied On June 24, 2004 02:37 PM

thank you.

Administrator [Syncfusion]
Replied On June 25, 2004 11:15 AM

I try out the sample in the other thread, column resizing doesn''t work too well. When resizing the column, it treats it as column re-ordering.

Administrator [Syncfusion]
Replied On June 25, 2004 11:38 AM

I think you can handle this problem by adding this if-code around the current ''big'' if in the OnMouseMove code in the derived grid. if(this.Cursor.Equals(Cursors.Arrow)) { //existing if statement } base.OnMouseMove(e);

Administrator [Syncfusion]
Replied On June 25, 2004 11:48 AM

I am using a GridControl in my code, but the sample is a GridDataBoundGrid, when I click on the header, the cursor is not an arrow. How do I make the cursor an arrow even if I click on the column for sorting?

Administrator [Syncfusion]
Replied On June 25, 2004 04:31 PM

Here is the sample modified to use a GridControl. If you want to catch the click on a header, you can return from the MouseUp without calling the base class if you have moved a column. This will make the CellClick only fire when you do not move a column. The sample seems to size columns, move column and catch a single click in the CellClick event for me. Forum_DragColOnFirstClick_3704.zip

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.

;