multi select and checkbox

Hi Community, 

So i have a ggc and i was wondering if it was possible to do different types of selections. So i want to be able to select multiple rows as well as being able to select multiple rows using shift key, and also is there a way to have a unbounded checkbox that updates when you select a row or multiple rows? any help wold be much appreciated! 

Thanks! 

4 Replies 1 reply marked as answer

BT Balamurugan Thirumalaikumar Syncfusion Team April 24, 2021 08:47 PM UTC

Hi Mohammed, 
 
Thank you for interest in Syncfusion products. 
 
We could understand the reported query “multi select and checkbox” at our end. Please refer the following details. 
 
So i have a ggc and i was wondering if it was possible to do different types of selections. So i want to be able to select multiple rows as well as being able to select multiple rows using shift key, 
If you want to select multiple records when clicking on the cell, set the ListBoxSelectionMode as SelectionMode.MultiExtended. By default you can select the multiple records using Ctrl key. Moreover, Shift key allows user to extend existing selection by holding Shift key and clicking a cell. 
 
Code Snippet 
//Multi record selection 
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; 
 
We have already provided UG documentation regarding the multiple ways in gridgrouping control. Please make use of the below UG,

Selections UG link - https://help.syncfusion.com/windowsforms/gridgrouping/selections#selectionmode---multiextended
 
 
and also is there a way to have a unbounded checkbox that updates when you select a row or multiple rows? any help wold be much appreciated! 
To achieve your requirement we suggest you to set the unbound checkbox and by using TableControlCurrentCellKeyDown and QueryCellStyleInfo event you can update the unbound checkbox column based on the selected/unselected records. Please refer the following code snippet for your reference. 
 
Code Snippet 
//Event Subscription 
this.gridGroupingControl1.TableControlCurrentCellKeyDown += GridGroupingControl1_TableControlCurrentCellKeyDown; 
 
//Event Customization 
private void GridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e) 
{ 
  var colinex = this.gridGroupingControl1.TableDescriptor.Columns["print"].GetRelativeColumnIndex() + 1; 
  //Move currentcell to checkbox colummn record 
  this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(e.TableControl.CurrentCell.RowIndex, colinex, Syncfusion.Windows.Forms.Grid.GridSetCurrentCellOptions.SetFocus); 
  this.gridGroupingControl1.Focus(); 
 
  GridStyleInfo style = e.TableControl.CurrentCell.Renderer.CurrentStyle; 
  //To check whether the current cell celltype is checkbox 
  if (style.CellType == GridCellTypeName.CheckBox)  
  { 
   this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 
  } 
} 
 
//Event Customization 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
  int rowIndex = e.TableCellIdentity.RowIndex; 
  //To update the checkbox only when the record is selected 
  if (this.gridGroupingControl1.TableModel.SelectedRanges.Contains(GridRangeInfo.Row(rowIndex)) && e.Style.CellType == GridCellTypeName.CheckBox)  
  { 
   e.Style.CellValue = true; 
   } 
   else 
   { 
    e.Style.CellValue = false; 
   } 
} 
 
 
 
 
We have attached the tested sample for your reference and you can download the same from the following location. 
 
Please let us know if you would require any other assistance. we will be happy to assist you. 
 
Regards 
Balmurugan.Thirumalaikumar 


Marked as answer

MS Mohammed Shafeel April 30, 2021 11:03 AM UTC

Hi Balamurugan, 

The solution you have provided i have acheived before but what i am looking for is a multi selection checkbox. i have achieved this in datagridview  and i have attached a recording to show you but i would like to achieve the same thing in ggc

Attachment: RDP.mp4_ffa2418d.zip


BT Balamurugan Thirumalaikumar Syncfusion Team May 4, 2021 04:14 AM UTC

Hi Mohammed, 
 
Thank you for your update. 
 
We could understand your scenario at our end. We are working on it to provide you the solution. Will update you the proper details on May 04,2021. We appreciate your patience till then. 
 
Regards, 
Balamurugan Thirumalaikumar 



BT Balamurugan Thirumalaikumar Syncfusion Team May 4, 2021 08:20 PM UTC

Hi Mohammed, 
 
Thank you for your patience. 
 
We could understand your requirement “i have achieved this in datagridview  and i have attached a recording to show you but i would like to achieve the same thing in ggc” at our end. In order to achieve your requirement we suggest to use the TableControlCheckBoxClick event to change the unbound checkbox state(checked/unchecked) as multiple. You can refer our tested sample for your reference. 
 
 
Please let us know if you would require any other assistance. we will be happy to assist you. 
 
Regards, 
Balamurugan Thirumalaikumar 


Loader.
Up arrow icon