We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Excel like selection

I am trying to achieve something how it is possible in excel,

On right clicking outside the selected cells, excel un-select the previous selected cell, select the current row and shows the pop up menu but in syncfusion Gridgroupingcontrol doesn't clear the previous selection when I right clicking outside the selected cells.

Can you please suggest how to do the same using Gridgroupingcontrol?


5 Replies

RB Ragamathulla B Syncfusion Team July 2, 2012 04:16 AM UTC

Hi Navaneethan,
 
Thank you for your interest in syncfusion products.
 
You can set the SelectCellsMouseButtonsMask to left button to prevent selections changing by right click.. Please refer to the following code which explains the same.
 
this.gridGroupingControl1.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;
 
Let me know if you have any further concerns.
 
Regards,
Ragamathullah B.


NA Navaneethakrishnan July 2, 2012 04:57 AM UTC

Hi Ragamathullah,

Thanks for your reply,

When I set the mask as left like below code,I have faced nother issue,whenever I right click on the cell directly without any selection of cells in the grid,It  should be selected the last right clicked cell but it doestn't select the active cell in grid grouping control.
 
this.gridGroupingControl1.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;

Issue: When I right click outside the selected cells, Grid control doesn't clear previous selections.

Expected Behavior: When I right click outside the selected cells, Grid control should be clear previous selections and select the current cell as active cell.

Can you please suggest how to do the same using Gridgroupingcontrol?

 


 



RB Ragamathulla B Syncfusion Team July 3, 2012 07:17 AM UTC



MM Mendel Monteiro-Beckerman January 20, 2015 02:56 PM UTC

It would be great to get this functionality working in the GridControl and the GridGroupingControl.

From the fact that currently the GridControl Excel-like demo does not display this behaviour and the lack of clarification below I assume it is not currently possible.


NK Neelakandan Kannan Syncfusion Team January 22, 2015 04:58 PM UTC

Hi Mendel,

 

Thank you for your update.

 

If you want to clear the selections on MouseRight Click in GridGroupingControl, you can clear the selection by handing TableControlMouseDown event. For this, you need to disable the AllowSelection property to None and ListBxSelectionMode as MultiExtended. Please make use of below code and attached sample,

 

Code Snippet:

this.gridGroupingControl1.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None;

            this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;

            this.gridGroupingControl1.TableModel.Options.SelectCellsMouseButtonsMask = System.Windows.Forms.MouseButtons.Left;

            this.gridGroupingControl1.TableControlMouseDown += new GridTableControlMouseEventHandler(gridGroupingControl1_TableControlMouseDown);

void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)

        {

            if (e.Inner.Button == System.Windows.Forms.MouseButtons.Right)

            {

                if (this.gridGroupingControl1.Table.SelectedRecords != null)

                {

                    foreach (SelectedRecord rec in this.gridGroupingControl1.Table.SelectedRecords)

                    {

                        this.gridGroupingControl1.Table.SelectedRecords.Remove(rec);

                    }

                }

            }

        }

   

Please let me know if you have any concerns.

 

Regards,

Neelakandan


Attachment: Sample_Clearing_Selection_d6a44673.zip

Loader.
Live Chat Icon For mobile
Up arrow icon