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

Extending selection with shift-arrow in grouping grid

The grouping grid does not support this whereas the ordinary grid control does. Do you think it would be easy to implement this behaviour for the grouping grid (e.g. by listening to a keypress event and changing the selection from code) If so could you provide a simple example on how to do it? I need it to work for a grouped grid, but not for a hierachical grid. (v3.2.1.0) Thanks in advance.

6 Replies

AD Administrator Syncfusion Team August 23, 2005 10:57 AM UTC

If you use the special record selection support in GridGroupingControl by settingthese properties, then you can shift select records across groups. this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;


AD Administrator Syncfusion Team August 23, 2005 11:16 AM UTC

I am using AllowSelection = GridSelectionFlags.Any; ListBoxSelectionMode = SelectionMode.None; (To enable block wise selection and copy) Do you thing the shift-arrow selection can be implemented in this case?


AD Administrator Syncfusion Team August 23, 2005 12:00 PM UTC

You can try using this event. I am sure you will have to spend some time cleaning this up to handle the cases you wnat to handle.
int startRow, startCol;
private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = e.TableControl.CurrentCell;
		
	if(Control.MouseButtons == MouseButtons.None
		&& 0 != (Control.ModifierKeys & Keys.Shift))
	{
		GridRangeInfo r1 = GridRangeInfo.Cell(startRow, startCol);
		GridRangeInfo r2 = GridRangeInfo.Cell(cc.MoveToRowIndex, cc.MoveToColIndex);
		r2 = r2.UnionRange(r1);
		e.TableControl.Model.Selections.Clear();
		e.TableControl.Model.Selections.Ranges.Add(r2);
		e.TableControl.InvalidateRange(r2);
	}
	else
	{
		startRow = cc.RowIndex;
		startCol = cc.ColIndex;
	}
}


AD Administrator Syncfusion Team August 23, 2005 02:22 PM UTC

This is working really well. I added a condition that handles row selections, apart from that I haven''t noticed any problems. This was really helpful, thanks a lot, Clay. Another question I have been wondering about: Would it be possible to highlight the row under the mouse pointer? This would make it visually easy to follow the data along a row. Maybe it could be done by handling the mouse move event and selecting the row under mouse? (This must not change the current record and should only be done if there were no selections already). If you think this is not too difucult and could provide an example, it would be great.


AD Administrator Syncfusion Team August 23, 2005 02:52 PM UTC

Here is a forum post that does something similar. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=33360


AD Administrator Syncfusion Team August 24, 2005 07:34 AM UTC

Works great. Thanks!

Loader.
Live Chat Icon For mobile
Up arrow icon