Current row pointer (highlighted)

Hi, 

We are using GGC multi-select in the grid, and the user wants to highlight the current row based from these scenarios:

1) Deleting a single grid, highlight the next one after deletion.
2) Highlighting multiple rows from top going down using mouse click then DO DELETION then identify and highlight the current row after deletion;
3) Highlighting multiple rows from down going up using mouse click then DO DELETION then identify and highlight the current row after deletion;
4) Highlighting multiple rows using CTRL-mouse-click randomly then DO DELETION then identify and highlight the current row after deletion;
5) Highlighting multiple rows using SHIFT-mouse-click (click one row then clicking another row down severals rows using SHIFT-mouse click) then DO DELETION then identify and highlight the current row after deletion;

So, what we have done so far in our code:

Single deletion and highlighting the next current row;

The other ones (2 to 5 above) are quite challenging and difficult to implement.

Thanks




1 Reply

SN Sindhu Nagarajan Syncfusion Team March 28, 2018 03:18 PM UTC

Hi Gary, 

Thanks for contacting Syncfusion support. 
 
GridGroupingControl has direct support to select multiple rows in a grid by setting ListBoxSelectionMode to MultiExtended. To delete a selected rows in the grid, DeleteAll() method can be used. Inorder to highlight the next row after the deleted rows, the index of the selected record(to be deleted) is passed to the SelectedRecords.Add() method. Please refer to the below code and sample, 
 
Code Example  
private void button1_Click(object sender, EventArgs e) 
{ 
    if (this.gridGroupingControl1.Table.SelectedRecords.Count > 0) 
    { 
        int index = -1; 
        foreach(var selectedRecord in this.gridGroupingControl1.Table.SelectedRecords) 
        { 
            index = selectedRecord.Record.GetSourceIndex(); 
            selectedRecord.Record.Delete(); 
        } 
 
        Record currentRecord = this.gridGroupingControl1.Table.Records[index]; 
        this.gridGroupingControl1.Table.SelectedRecords.Add(currentRecord); 
    } 
} 
 

Please let us know if you have any other queries. 

Regards, 
Sindhu  


Loader.
Up arrow icon