GridGroupingControl - Quickly Select All the records
HI,
I am using GGC. When user opts for "Select All" option, i have to select all records in thr GGC.
Currently I am using the below code.
foreach (Record record in GGC.Table.Records )
{
GGC.Table.SelectedRecords.Add(record);
}
But, when the grid is having thousands of records, this code is slow.
I am wondering is there any single method like SelectAllRecords()/AddAllRecords to the SelectedRecords collection? (as we have GGC.Table.SelectedRecords.Clear() )..
Plz inform me.
Rgds
Badri Rajani Kanth
SIGN IN To post a reply.
4 Replies
AD
Administrator
Syncfusion Team
February 8, 2006 02:28 PM UTC
Hi Badri,
You can use the SelectRange method to select all the records in the Grid. Here is the code snippet.
// To select particular records
this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Rows(5,this.gridGroupingControl1.TableControl.Model.RowCount),true);
// To select the table
this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Table(),true);
Let us know if you need further assistance,
Regards,
Madhan.
BR
Badri Rajani Kanth
February 8, 2006 02:41 PM UTC
Hi Madan,
I tried with SelectRange earlier. But firstly, as selection using SelectRange is making the grid selection in black color.(gridGroupingControl1.Table.SelectedRecords.Add(record) selects in blue color). I dont know if there any other differences with SelectRange.
As I am using many events (ex SelectedRecordsChanging), I am not sure if there can be any impact on my screen.
PLz let me know.
Rgds
Rajani Kanth
>Hi Badri,
>
>You can use the SelectRange method to select all the records in the Grid. Here is the code snippet.
>
>// To select particular records
>this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Rows(5,this.gridGroupingControl1.TableControl.Model.RowCount),true);
>
>// To select the table
>this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Table(),true);
>
>Let us know if you need further assistance,
>
>Regards,
>Madhan.
AD
Administrator
Syncfusion Team
February 9, 2006 05:17 AM UTC
Hi Badri,
If you do not set the selection flag then, the selection will become black. Here is the code snippet to avoid this.
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;
this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Rows(5,this.gridGroupingControl1.TableControl.Model.RowCount),true);
Refer this sample for details
Let us know if you need further assistance,
Regards,
Madhan
BR
Badri Rajani Kanth
February 9, 2006 11:22 AM UTC
Hi,
We are using :
TableOptions.AllowSelection = GridSelectionFlags.None;
TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
And ours is new record selection mechanism and we are using Table.SelectedRecords collection at many places in the application. Many related events are handled in the application.
And also, this is what I have read in Synchfusion documentation.
------------------------------
Starting version 3.x the GridGroupingControl now supports multiple record selection and navigation across nested tables. In order to use the new record selection mechanism you need to set TableOptions.ListBoxSelection = SelectionMode.XYZ and make sure that TableOptions.AllowSelection = GridSelectionFlags.None. Optional settings can be specified with TableOptions.ListBoxSelectionColorOptions and TableOptions.ListBoxSelectionCurrentCellOptions.
With the new record-based selection mode selected records can be found in Table.SelectedRecords collection.
If you specify a different value for TableOptions.AllowSelection other than GridSelectionFlags.None the grid will operate in a backward-compatible mode and continue to use the old selection mechanism that was in place with 2.x and 1.x versions of the GridGroupingControl.
Use TableOptions.AllowSelection only if you explicitly want the old selection behavior, e.g. if you want to be able to select individual cells or want to use Excel-like selection behavior.
With the backward compatible selection mode selected rows and cells can be found in TableModel.Selections.Ranges collection.
------------------------------
So, I am affraid, If I change the selection back to old selection mechanism(by changing TableOptions.AllowSelection), there can be problems with lots of functionalities. I may need to re-test and re-write a lot. This is why I am not working with selectionchanging methods.
Please let me know if there is a way..
Rgds
Rajani Kanth
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
BR Badri Rajani Kanth
- Feb 8, 2006 01:44 PM UTC
- Feb 9, 2006 11:22 AM UTC