Tracking Row Selection

Hi,

My application needs to update different Graphics Path Objects depending on which rows get selected in a GridGroupingControl with Nested tables and invalidate a graphics control. When the user is doing multi selection I would like to wait until all the selection events finish processing until the last selection event. (One question would that be the row that is actually selected?). Then I want to process the current set of selected records all at once and do the invalidate rather then one at a time while they are being selected.

Is this possible?

4 Replies

AD Administrator Syncfusion Team July 28, 2006 06:40 AM UTC

Hi Bill,

Are you using cell based selection tech? If so, you can use grid.TableModel.SelectionChanged event and check the e.Reason = GridSelectionReason.MouseUp for indicating the end of the selection. Please find the code snippet below.

//Enable the cell based selection tech
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;

private void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
if(e.Reason == GridSelectionReason.MouseUp)
{
GridTableModel model = sender as GridTableModel;
foreach(GridRangeInfo info in model.Selections.GetSelectedRows(true,true))
{
for(int i = info.Top ; i<= info.Bottom ;i++)
{
//To get the selected records.
// and invalid the record here....
if( model.Table.DisplayElements[i].Kind == DisplayElementKind.Record)
Console.WriteLine(i +":::" + model.Table.DisplayElements[i].ParentRecord);

}
}
}
}

For more details about selection types, See
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Regards,
Haneef


BL Bill Langlais July 31, 2006 02:47 AM UTC

Hi,

I am using:

GridGroupingControl->SelectedRecordsChanged

>Hi Bill,

Are you using cell based selection tech? If so, you can use grid.TableModel.SelectionChanged event and check the e.Reason = GridSelectionReason.MouseUp for indicating the end of the selection. Please find the code snippet below.

//Enable the cell based selection tech
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;

private void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
if(e.Reason == GridSelectionReason.MouseUp)
{
GridTableModel model = sender as GridTableModel;
foreach(GridRangeInfo info in model.Selections.GetSelectedRows(true,true))
{
for(int i = info.Top ; i<= info.Bottom ;i++)
{
//To get the selected records.
// and invalid the record here....
if( model.Table.DisplayElements[i].Kind == DisplayElementKind.Record)
Console.WriteLine(i +":::" + model.Table.DisplayElements[i].ParentRecord);

}
}
}
}

For more details about selection types, See
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Regards,
Haneef


BL Bill Langlais July 31, 2006 03:36 AM UTC

Hi,

Can I use the GridgroupingControls MouseUp event? It seems like the only time you would get a mouse up is when a row is being either selected or deselected.


AD Administrator Syncfusion Team July 31, 2006 10:38 AM UTC

Hi Bill,

You need to use the TableControl.MouseUp event for detecting the end of the record selection in a grid.

this.gridGroupingControl1.GetTableControl("YourTableName").MouseUp +=new MouseEventHandler(TableControl_MouseUp);

private void TableControl_MouseUp(object sender, MouseEventArgs e)
{
Console.WriteLine("End of the selection changed event");
}

Let me know if this helps.
Best Regards,
Haneef

Loader.
Up arrow icon