Selecting Multiple Rows in Syncfusion GridGroupingControl

Applies to TestComplete 15.40, last modified on July 05, 2022

When working with Syncfusion GridGroupingControl, you may need to simulate the selection of multiple grid rows. You can then perform various operations over the selected rows, for example, obtain their cell values, copy their data to the clipboard, and so on. Note that multi-selection in GridGroupingControl is only possible if the grid’s Table.TableOptions.ListBoxSelectionMode is “MultiSimple” or “MultiExtended”. If you are not sure whether the tested grid control supports multi-selection, ask the tested application’s developer. You can also check this yourself by trying to select multiple grid rows with Ctrl- or Shift-clicks.

The following sections describe approaches that can be used to select multiple rows in the GridGroupingControl:

To perform these actions, TestComplete should have access to internal objects, properties and methods of the GridGroupingControl object. For this purpose, the .NET Application Support and Syncfusion Systems Control Support plugins must be installed and enabled. The latter lets you work with the GridGroupingControl controls using methods and properties of the SyncfusionEssGrid object. Without this plugin, you will not be able to work with controls using their internal methods and properties.

When testing Syncfusion GridGroupingControl controls, use specific methods and properties of the corresponding SyncfusionEssGrid object. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with an object’s properties and methods from your scripts. However, when testing a GridGroupingControl control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.

Simulating Selections With Mouse

Normally, the users can select multiple rows in the GridGroupingControl by pressing Ctrl or Shift while selecting the rows. Holding Ctrl while selecting the row will add it to the current selection, and holding Shift will extend selection to the selected row.

To simulate a click on a row indicator, use the ClickRowIndicator action of the SyncEssGrid object. The parameters of these actions specify the row to be clicked, and also whether the Shift, Ctrl, Alt or combination of these keys should be pressed during the click.

Below is an example that illustrates how you can use these actions to select multiple rows and a range of rows in the grid.

Example

View description

JavaScript, JScript

function Main ()
{
  var p, Grid, RowIndexes;

  // Obtain the grid object
  p = Sys.Process("MultipleRecordSelection");
  p.WinFormsObject("Form1").Maximize();
  Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1");

  // Select rows 7-21 in the root table
  SelectRange (Grid, 7, 21);
  aqUtils.Delay (1000);

  // Select multiple rows in a nested table
  Grid.Expand(4);
  RowIndexes = new Array (1, 2, 4, 7, 14);
  SelectRows (Grid.wChildView(4,0), RowIndexes);
}

// Selects the specified range of rows
function SelectRange (View, StartRowIndex, EndRowIndex)
{
  // Select the first row of the range
  View.ClickRowIndicator (StartRowIndex);
  // Extend the selection
  View.ClickRowIndicator (EndRowIndex, skShift);
}

// Selects the specified rows
function SelectRows (View, RowIndexes)
{
  // Select the first of the specified rows
  View.ClickRowIndicator (RowIndexes[0]);
  // Add other rows to the selection
  for (var i=1; i<RowIndexes.length; i++)
    View.ClickRowindicator (RowIndexes[i], skCtrl);
}

Python

def Main ():

  # Obtain the grid object
  p = Sys.Process("MultipleRecordSelection")
  p.WinFormsObject("Form1").Maximize()
  Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1")

  # Select rows 7-21 in the root table
  SelectRange (Grid, 7, 21)
  aqUtils.Delay (1000)

  # Select multiple rows in a nested table
  Grid.Expand(4)
  RowIndexes = list(1, 2, 4, 7, 14)
  SelectRows (Grid.wChildView[4,0], RowIndexes)

# Selects the specified range of rows
def SelectRange (View, StartRowIndex, EndRowIndex):
  # Select the first row of the range
  View.ClickRowIndicator (StartRowIndex)
  # Extend the selection
  View.ClickRowIndicator (EndRowIndex, skShift)

# Selects the specified rows
def SelectRows (View, RowIndexes):
  # Select the first of the specified rows
  View.ClickRowIndicator (RowIndexes[0])
  # Add other rows to the selection
  for i in range(1, RowIndexes.length-1):
    View.ClickRowindicator (RowIndexes[i], skCtrl)

VBScript

Sub Main
  Dim p, Grid, RowIndexes

  ' Obtain the grid object
  Set p = Sys.Process("MultipleRecordSelection")
  p.WinFormsObject("Form1").Maximize
  Set Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1")

  ' Select rows 7-21 in the root table
  Call SelectRange (Grid, 7, 21)
  aqUtils.Delay (1000)

  ' Select multiple rows in a nested table
  Grid.Expand(4)
  RowIndexes = Array (1, 2, 4, 7, 14)
  Call SelectRows (Grid.wChildView(4,0), RowIndexes)
End Sub

' Selects the specified range of rows
Sub SelectRange (View, StartRowIndex, EndRowIndex)
  ' Select the first row of the range
  View.ClickRowIndicator (StartRowIndex)
  ' Extend the selection
  Call View.ClickRowIndicator (EndRowIndex, skShift)
End Sub

' Selects the specified rows
Sub SelectRows (View, RowIndexes)
  ' Select the first of the specified rows
  View.ClickRowIndicator (RowIndexes(0))
  ' Add other rows to the selection
  For i=1 To UBound(RowIndexes)
    Call View.ClickRowindicator (RowIndexes(i), skCtrl)
  Next
End Sub

DelphiScript

procedure SelectRange (View, StartRowIndex, EndRowIndex); forward;
procedure SelectRows (View, RowIndexes); forward;

procedure Main;
var p, Grid, RowIndexes : OleVariant;
begin
  // Obtain the grid object
  p := Sys.Process('MultipleRecordSelection');
  p.WinFormsObject('Form1').Maximize;
  Grid := p.WinFormsObject('Form1').WinFormsObject('gridGroupingControl1');

  // Select rows 7-21 in the root table
  SelectRange (Grid, 7, 21);
  aqUtils.Delay (1000);

  // Select multiple rows in a nested table
  Grid.Expand(4);
  RowIndexes := CreateVariantArray (0, 4);
  RowIndexes[0] := 1; RowIndexes[1] := 2;
  RowIndexes[2] := 4; RowIndexes[3] := 7;
  RowIndexes[3] := 14;
  SelectRows (Grid.wChildView[4,0], RowIndexes);
end;

// Selects the specified range of rows
procedure SelectRange (View, StartRowIndex, EndRowIndex);
begin
  // Select the first row of the range
  View.ClickRowIndicator (StartRowIndex);
  // Extend the selection
  View.ClickRowIndicator (EndRowIndex, skShift);
end;

// Selects the specified rows
procedure SelectRows (View, RowIndexes);
var i : OleVariant;
begin
  // Select the first of the specified rows
  View.ClickRowIndicator (RowIndexes[0]);
  // Add other rows to the selection
  for i := 1 to VarArrayHighBound(RowIndexes, 1)-1 do
    View.ClickRowindicator (RowIndexes[i], skCtrl);
end;

C++Script, C#Script

function Main ()
{
  var p, Grid, RowIndexes;

  // Obtain the grid object
  p = Sys["Process"]("MultipleRecordSelection");
  p["WinFormsObject"]("Form1")["Maximize"]();
  Grid = p["WinFormsObject"]("Form1")["WinFormsObject"]("gridGroupingControl1");

  // Select rows 7-21 in the root table
  SelectRange (Grid, 7, 21);
  aqUtils["Delay"] (1000);

  // Select multiple rows in a nested table
  Grid["Expand"](4);
  RowIndexes = new Array (1, 2, 4, 7, 14);
  SelectRows (Grid["wChildView"](4,0), RowIndexes);
}

// Selects the specified range of rows
function SelectRange (View, StartRowIndex, EndRowIndex)
{
  // Select the first row of the range
  View["ClickRowIndicator"](StartRowIndex);
  // Extend the selection
  View["ClickRowIndicator"](EndRowIndex, skShift);
}

// Selects the specified rows
function SelectRows (View, RowIndexes)
{
  // Select the first of the specified rows
  View["ClickRowIndicator"](RowIndexes[0]);
  // Add other rows to the selection
  for (var i=1; i<RowIndexes["length"]; i++)
    View["ClickRowindicator"](RowIndexes[i], skCtrl);
}

Using GridGroupingControl Internal Methods

The GridGroupingControl lets you programmatically manage the selected rows in each grid table; the root table as well as in tested tables. You can obtain the collection of records selected in a grid table using the following statements:

GridObj.Table.SelectedRecords

GridObj.GetTable(TableName).SelectedRecords

The first statement lets you get the collection of data rows selected in the grid’s root table, and the second one returns the records selected in a nested table (the table name is specified by the TableName parameter).

To select and unselect grid rows, use the following methods of the obtained collection:

  • Add (RecordObj) -- Adds a row to the selection. The RecordObj parameter specifies the object corresponding to the desired row. You can obtain such an object using the GetRecord routine from the Selecting Cells in Syncfusion GridGroupingControl topic.
  • Remove (RecordObj) -- Unselects the specified row.
  • Clear -- Unselects all rows in a table.

The following example demonstrates how you can select and unselect rows in the GridGroupingControl.

Example

View description

JavaScript

function Main ()
{
  var p, Grid, RowIndexes;

  // Obtain the grid object
  p = Sys.Process("MultipleRecordSelection");
  p.WinFormsObject("Form1").Maximize();
  Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1");

  // Collapse all rows in the grid
  Grid.Table.CollapseAllRecords();

  // Select rows 10-20
  SelectRange (Grid, null, 10, 20);
  aqUtils.Delay (1000);

  // Clear selection
  ClearSelection (Grid, null);
  aqUtils.Delay (1000);

  // Select multiple rows
  RowIndexes = new Array (10, 12, 15, 17, 23);
  SelectRows (Grid, null, RowIndexes);
}

function SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex)
{
  var SelectedRecords, Rec;

  // Get the selected records in the specified table or group
  if (strictEqual(TableOrGroup, null))
    SelectedRecords = Grid.Table.SelectedRecords
  else
    SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords;

  // Clear the previous selection
  SelectedRecords.Clear();

  // Select the specified range of rows
  for (let i=StartRowIndex; i<=EndRowIndex; i++)
  {
    Rec = GetRecord (Grid, TableOrGroup, i);
    SelectedRecords.Add (Rec);
  }
}

function SelectRows (Grid, TableOrGroup, RecIndexes)
{
  var SelectedRecords, Rec;

  // Get the selected records in the specified table or group
  if (strictEqual(TableOrGroup, null))
    SelectedRecords = Grid.Table.SelectedRecords
  else
    SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords;

  // Clear the previous selection
  SelectedRecords.Clear();

  // Select the specified rows
  for (let i=0; i<RecIndexes.length; i++)
  {
    Rec = GetRecord (Grid, TableOrGroup, RecIndexes[i]);
    SelectedRecords.Add (Rec);
  }
}

function ClearSelection (Grid, TableOrGroup)
{
  if (strictEqual(TableOrGroup, null))
    Grid.Table.SelectedRecords.Clear()
  else
    Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords.Clear();
}

function GetRecord (Grid, TableOrGroup, Recindex)
{
  // Get the root table if no table is specified
  if (strictEqual(TableOrGroup, null))
    TableOrGroup = Grid.Table.TopLevelGroup;

  return TableOrGroup.Records.Item_2(Recindex);
}

JScript

function Main ()
{
  var p, Grid, RowIndexes;

  // Obtain the grid object
  p = Sys.Process("MultipleRecordSelection");
  p.WinFormsObject("Form1").Maximize();
  Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1");

  // Collapse all rows in the grid
  Grid.Table.CollapseAllRecords();

  // Select rows 10-20
  SelectRange (Grid, null, 10, 20);
  aqUtils.Delay (1000);

  // Clear selection
  ClearSelection (Grid, null);
  aqUtils.Delay (1000);

  // Select multiple rows
  RowIndexes = new Array (10, 12, 15, 17, 23);
  SelectRows (Grid, null, RowIndexes);
}

function SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex)
{
  var SelectedRecords, Rec, i;

  // Get the selected records in the specified table or group
  if (TableOrGroup == null)
    SelectedRecords = Grid.Table.SelectedRecords
  else
    SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords;

  // Clear the previous selection
  SelectedRecords.Clear();

  // Select the specified range of rows
  for (i=StartRowIndex; i<=EndRowIndex; i++)
  {
    Rec = GetRecord (Grid, TableOrGroup, i);
    SelectedRecords.Add (Rec);
  }
}

function SelectRows (Grid, TableOrGroup, RecIndexes)
{
  var SelectedRecords, Rec, i;

  // Get the selected records in the specified table or group
  if (TableOrGroup == null)
    SelectedRecords = Grid.Table.SelectedRecords
  else
    SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords;

  // Clear the previous selection
  SelectedRecords.Clear();

  // Select the specified rows
  for (i=0; i<RecIndexes.length; i++)
  {
    Rec = GetRecord (Grid, TableOrGroup, RecIndexes[i]);
    SelectedRecords.Add (Rec);
  }
}

function ClearSelection (Grid, TableOrGroup)
{
  if (TableOrGroup == null)
    Grid.Table.SelectedRecords.Clear()
  else
    Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords.Clear();
}

function GetRecord (Grid, TableOrGroup, Recindex)
{
  // Get the root table if no table is specified
  if (TableOrGroup == null)
    TableOrGroup = Grid.Table.TopLevelGroup;

  return TableOrGroup.Records.Item_2(Recindex);
}

Python

def Main ():

  # Obtain the grid object
  p = Sys.Process("MultipleRecordSelection")
  p.WinFormsObject("Form1").Maximize()
  Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1")

  # Collapse all rows in the grid
  Grid.Table.CollapseAllRecords()

  # Select rows 10-20
  SelectRange (Grid, None, 10, 20)
  aqUtils.Delay (1000)

  # Clear selection
  ClearSelection (Grid, None)
  aqUtils.Delay (1000)

  # Select multiple rows
  RowIndexes = list(10, 12, 15, 17, 23)
  SelectRows (Grid, None, RowIndexes)

def SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex):

  # Get the selected records in the specified table or group
  if (TableOrGroup == None):
    SelectedRecords = Grid.Table.SelectedRecords
  else:
    SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords

  # Clear the previous selection
  SelectedRecords.Clear()

  # Select the specified range of rows
  for i in range(StartRowIndex, EndRowIndex):
    Rec = GetRecord (Grid, TableOrGroup, i)
    SelectedRecords.Add (Rec)

def SelectRows (Grid, TableOrGroup, RecIndexes):

  # Get the selected records in the specified table or group
  if (TableOrGroup == None):
    SelectedRecords = Grid.Table.SelectedRecords
  else:
    SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords

  # Clear the previous selection
  SelectedRecords.Clear()

  # Select the specified rows
  for i in range(0, RecIndexes.length-1):
    Rec = GetRecord (Grid, TableOrGroup, RecIndexes[i])
    SelectedRecords.Add (Rec)

def ClearSelection (Grid, TableOrGroup):
  if (TableOrGroup == None):
    Grid.Table.SelectedRecords.Clear()
  else:
    Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords.Clear()

def GetRecord (Grid, TableOrGroup, Recindex):
  # Get the root table if no table is specified
  if (TableOrGroup == None):
    TableOrGroup = Grid.Table.TopLevelGroup

  return TableOrGroup.Records.Item_2(Recindex)

VBScript

Sub Main
  Dim p, Grid, RowIndexes

  ' Obtain the grid object
  Set p = Sys.Process("MultipleRecordSelection")
  p.WinFormsObject("Form1").Maximize
  Set Grid = p.WinFormsObject("Form1").WinFormsObject("gridGroupingControl1")

  ' Collapse all rows
  Grid.Table.CollapseAllRecords

  ' Select rows 10-20
  Call SelectRange (Grid, Nothing, 10, 20)
  Call aqUtils.Delay (1000)

  ' Clear selection
  Call ClearSelection (Grid, Nothing)
  Call aqUtils.Delay (1000)

  ' Select multiple rows
  RowIndexes = Array (10, 12, 15, 17, 23)
  Call SelectRows (Grid, Nothing, RowIndexes)
End Sub

Sub SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex)
  Dim SelectedRecords, Rec, i

  ' Get the selected records in the specified table or group
  If TableOrGroup Is Nothing Then
    Set SelectedRecords = Grid.Table.SelectedRecords
  Else
    Set SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords
  End If

  ' Clear the previous selection
  SelectedRecords.Clear

  ' Select the specified range of rows
  For i = StartRowIndex To EndRowIndex
    Set Rec = GetRecord (Grid, TableOrGroup, i)
    Call SelectedRecords.Add (Rec)
  Next
End Sub

Sub SelectRows (Grid, TableOrGroup, RecIndexes)
  Dim SelectedRecords, Rec, i

  ' Get the selected records in the specified table or group
  If TableOrGroup Is Nothing Then
    Set SelectedRecords = Grid.Table.SelectedRecords
  Else
    Set SelectedRecords = Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords
  End If

  ' Clear the previous selection
  SelectedRecords.Clear

  ' Select the specified rows
  For i = LBound(RecIndexes) To UBound(RecIndexes)
    Set Rec = GetRecord (Grid, TableOrGroup, RecIndexes(i))
    Call SelectedRecords.Add (Rec)
  Next
End Sub

Sub ClearSelection (Grid, TableOrGroup)
  If TableOrGroup Is Nothing Then
    Grid.Table.SelectedRecords.Clear
  Else
    Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords.Clear
  End If
End Sub

Function GetRecord (Grid, TableOrGroup, RecordIndex)
  ' Get the root table if no table is specified
  If TableOrGroup Is Nothing Then
    Set TableOrGroup = Grid.Table.TopLevelGroup
  End If

  Set GetRecord = TableOrGroup.Records.Item_2(RecordIndex)
End Function

DelphiScript

procedure SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex); forward;
procedure SelectRows (Grid, TableOrGroup, RecIndexes); forward;
procedure ClearSelection (Grid, TableOrGroup); forward;
function GetRecord (Grid, TableOrGroup, RecordIndex); forward;

procedure Main;
var p, Grid, RowIndexes : OleVariant;
begin
  // Obtain the grid object
  p := Sys.Process('MultipleRecordSelection');
  p.WinFormsObject('Form1').Maximize;
  Grid := p.WinFormsObject('Form1').WinFormsObject('gridGroupingControl1');

  // Clear selection
  Grid.Table.CollapseAllRecords;

  // Select rows 10-20
  SelectRange (Grid, nil, 10, 20);
  aqUtils.Delay (1000);

  // Clear selection
  ClearSelection (Grid, nil);
  aqUtils.Delay (1000);

  // Select multiple rows
  RowIndexes := CreateVariantArray (0, 4);
  RowIndexes[0] := 10; RowIndexes[1] := 12;
  RowIndexes[2] := 15; RowIndexes[3] := 17;
  RowIndexes[4] := 23;
  SelectRows (Grid, nil, RowIndexes);
end;

procedure SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex);
var SelectedRecords, Rec, i : OleVariant;
begin
  // Get the selected records in the specified table or group
  if TableOrGroup = nil then
    SelectedRecords := Grid.Table.SelectedRecords
  else
    SelectedRecords := Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords;

  // Clear the previous selection
  SelectedRecords.Clear;

  // Select the specified range of rows
  for i:=StartRowIndex to EndRowIndex do
  begin
    Rec := GetRecord (Grid, TableOrGroup, i);
    SelectedRecords.Add (Rec);
  end
end;

procedure SelectRows (Grid, TableOrGroup, RecIndexes);
var SelectedRecords, Rec, i : OleVariant;
begin
  // Get the selected records in the specified table or group
  if TableOrGroup = nil then
    SelectedRecords := Grid.Table.SelectedRecords
  else
    SelectedRecords := Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords;

  // Clear the previous selection
  SelectedRecords.Clear;

  // Select the specified rows
  for i:=VarArrayLowBound(RecIndexes, 1) to VarArrayHighBound(RecIndexes, 1) do
  begin
    Rec := GetRecord (Grid, TableOrGroup, RecIndexes[i]);
    SelectedRecords.Add (Rec);
  end
end;

procedure ClearSelection (Grid, TableOrGroup);
begin
  if TableOrGroup = nil then
    Grid.Table.SelectedRecords.Clear
  else
    Grid.GetTable(TableOrGroup.ParentTableDescriptor.Name).SelectedRecords.Clear;
end;

function GetRecord (Grid, TableOrGroup, RecordIndex);
begin
  // Get the root table if no table is specified
  if TableOrGroup = nil then
    TableOrGroup := Grid.Table.TopLevelGroup;

  Result := TableOrGroup.Records.Item_2[RecordIndex];
end;

C++Script, C#Script

function Main ()
{
  var p, Grid, RowIndexes;

  // Obtain the grid object
  p = Sys["Process"]("MultipleRecordSelection");
  p["WinFormsObject"]("Form1")["Maximize"]();
  Grid = p["WinFormsObject"]("Form1")["WinFormsObject"]("gridGroupingControl1");

  // Collapse all rows in the grid
  Grid["Table"]["CollapseAllRecords"]();

  // Select rows 10-20
  SelectRange (Grid, null, 10, 20);
  aqUtils["Delay"] (1000);

  // Clear selection
  ClearSelection (Grid, null);
  aqUtils["Delay"] (1000);

  // Select multiple rows
  RowIndexes = new Array (10, 12, 15, 17, 23);
  SelectRows (Grid, null, RowIndexes);
}

function SelectRange (Grid, TableOrGroup, StartRowIndex, EndRowIndex)
{
  var SelectedRecords, Rec, i;

  // Get the selected records in the specified table or group
  if (TableOrGroup == null)
    SelectedRecords = Grid["Table"]["SelectedRecords"]
  else
    SelectedRecords = Grid["GetTable"](TableOrGroup["ParentTableDescriptor"]["Name"])["SelectedRecords"];

  // Clear the previous selection
  SelectedRecords["Clear"]();

  // Select the specified range of rows
  for (i=StartRowIndex; i<=EndRowIndex; i++)
  {
    Rec = GetRecord (Grid, TableOrGroup, i);
    SelectedRecords["Add"](Rec);
  }
}

function SelectRows (Grid, TableOrGroup, RecIndexes)
{
  var SelectedRecords, Rec, i;

  // Get the selected records in the specified table or group
  if (TableOrGroup == null)
    SelectedRecords = Grid["Table"]["SelectedRecords"]
  else
    SelectedRecords = Grid["GetTable"](TableOrGroup["ParentTableDescriptor"]["Name"])["SelectedRecords"];

  // Clear the previous selection
  SelectedRecords["Clear"]();

  // Select the specified rows
  for (i=0; i<RecIndexes["length"]; i++)
  {
    Rec = GetRecord (Grid, TableOrGroup, RecIndexes[i]);
    SelectedRecords["Add"](Rec);
  }
}

function ClearSelection (Grid, TableOrGroup)
{
  if (TableOrGroup == null)
    Grid["Table"]["SelectedRecords"]["Clear"]()
  else
    Grid["GetTable"](TableOrGroup["ParentTableDescriptor"]["Name"])["SelectedRecords"]["Clear"]();
}

function GetRecord (Grid, TableOrGroup, Recindex)
{
  // Get the root table if no table is specified
  if (TableOrGroup == null)
    TableOrGroup = Grid["Table"]["TopLevelGroup"];

  return TableOrGroup["Records"]["Item_2"](Recindex);
}

See Also

Working With Syncfusion GridGroupingControl
ClickRowIndicator Action (Grid Controls)
Obtaining Selected Rows in Syncfusion GridGroupingControl
Iterating Through Rows in Syncfusion GridGroupingControl
Selecting Cells in Syncfusion GridGroupingControl

Highlight search results