Difficulties navigating the Grid

Hello everyone I'm trying to register invoice lines using GridGroupingControl.

As I have a set of doubts, I attach a small example so you can understand what I need


1) In the first column I have a combo duly filled in. How can I make it appear filled with the first element of the Combo by default?


2) If, after choosing the element I want in the combo, pressing the Return key adds the line to the grid. But using the TAB key or the mouse no longer does it.

How can I force the same behavior as the Return key?


3) how can I force column change in grid when pressing return key?


4) when pressing the return key in the last editable column of the grid, how can I change to the first column of the next row.


5) I am validating the grid cell contents in Grelha_TableControlCurrentCellValidating. When I press the CTRL+L keys, I'll get information for the grid and the database. I fill the Grid columns with this information. How can I force it to go through Grid_TableControlCurrentCellValidating in order to validate the information obtained.


hoping someone can help me :-)

Ricardo


Attachment: Grelha_4b3ac204.rar

24 Replies

VS Vijayarasan Sivanandham Syncfusion Team February 9, 2022 02:37 PM UTC

Hi Ricardo Abranches,

Currently, we are analyzing your requirement of “Difficulties navigating the GridGroupingControl” We will validate and update you the details on or before February 11, 2022.

We appreciate your patience until then.

Regards,
Vijayarasan S



RA Ricardo Abranches replied to Vijayarasan Sivanandham February 9, 2022 03:01 PM UTC

Thanks for your help

Keep Safe

Ricardo



VS Vijayarasan Sivanandham Syncfusion Team February 11, 2022 02:32 PM UTC

Hi Ricardo Abranches, 

Please find answer for your queries below 

Queries 
Solutions 
 
In the first column I have a combo duly filled in. How can I make it appear filled with the first element of the Combo by default? 

Your requirement to add the first element of the Combo by default value in AddNewRecord of GridGroupingControl can be achieved by using ShowDefaultValuesInAddNewRecord and DefaultValue properties. Please refer the below code snippet, 

'default value for ComboBox 
gridGroupingControl1.ShowDefaultValuesInAddNewRecord = True 
gridGroupingControl1.TableDescriptor.Fields("Tipo").DefaultValue = "1" 


 
If, after choosing the element I want in the combo, pressing the Return key adds the line to the grid. But using the TAB key or the mouse no longer does it. 
 
How can I force the same behavior as the Return key? 
 

Your requirement to add the new row to the grid when pressing tab key or mouse click can be achieved by customizing the TableControlCurrentCellEditingComplete event in GridGroupingControl. Please refer the below code snippet, 

'TAB key or the mouse behavior as the Return key          
AddHandler gridGroupingControl1.TableControlCurrentCellEditingComplete, AddressOf OnTableControlCurrentCellEditingComplete 
 
Private Sub OnTableControlCurrentCellEditingComplete(ByVal sender As Object, ByVal e As GridTableControlEventArgs) 
                Dim columnIndex = gridGroupingControl1.TableDescriptor.ColIndexToField(e.TableControl.CurrentCell.ColIndex) 
                If gridGroupingControl1.TableDescriptor.Columns(columnIndex).MappingName = "Tipo" Then 
                                'Translates the Tab key or mouse to a Enter key. 
                                SendKeys.Send("{ENTER}") 
                End If 
End Sub 


 
how can I force column change in grid when pressing return key? 

Your requirement to move focus to next column when pressing return key in GridGroupingControl can be achieved by setting GridDirectionType.Right for EnterKeyBehavior property in GridGroupingControl.Table.TableModel.Options.  Please refer the below code snippet, 
 
'column change in grid when pressing return key 
gridGroupingControl1.Table.TableModel.Options.EnterKeyBehavior = GridDirectionType.Right 


 
when pressing the return key in the last editable column of the grid, how can I change to the first column of the next row. 
 

Your requirement to move focus to the first column of the next row when pressing return key in last column in GridGroupingControl can be achieved by setting GridWrapCellBehavior.WrapRow for WrapCellBehavior property in GridGroupingControl.Table.TableModel.Options.  Please refer the below code snippet, 
 
'change to the first column of the next row 
gridGroupingControl1.Table.TableModel.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow 


 
I am validating the grid cell contents in Grelha_TableControlCurrentCellValidating. When I press the CTRL+L keys, I'll get information for the grid and the database. I fill the Grid columns with this information. How can I force it to go through Grid_TableControlCurrentCellValidating in order to validate the information obtained. 
 

Your requirement to validating the grid cell contents when pressing return CTRL+L keys in GridGroupingControl can be achieved by calling the CurrentCell.Validate method in e.TableControl.  Please refer the below code snippet, 

Private Sub OnTableControlCurrentCellKeyUp(ByVal sender As Object, ByVal e As GridTableControlKeyEventArgs) 
    
      If e.TableControl.CurrentCell.ColIndex = 3 Then 
               Select Case e.Inner.KeyCode 
                     Case Keys.L 
                                e.TableControl.Table.CurrentRecord.SetValue("CustomerID", "efa21011") 
                             e.TableControl.Table.CurrentRecord.SetValue("CustomerName", "Artigo efa21011") 
 
                              ' To trigger the CurrentCellValidating event.                            
                                e.TableControl.CurrentCell.Validate() 
                                Exit Select 
 
                       Case Keys.F 
                                Exit Select 
 
                       Case Else 
                                Exit Select 
                End Select 
        End If 
End Sub 






Please let us know if you have any concerns in this. 

Regards, 
Vijayarasan S 




RA Ricardo Abranches replied to Vijayarasan Sivanandham February 11, 2022 05:07 PM UTC

Thanks for your help :-)

i will try the solutions that you provided


Have a nice weekend, and keep safe.



VS Vijayarasan Sivanandham Syncfusion Team February 14, 2022 09:38 AM UTC

Hi Ricardo Abranches,

Please try at your end once you find time. Also, let us know if you require any further assistance on this. we will be happy to assist you.

Regards,
Vijayarasan S


RA Ricardo Abranches July 20, 2023 09:54 AM UTC

Good Morning

my apologies for returning to this subject so late.

The example sent, which along with some more parameterizations, has two problems.

1 - I can't get it to go to the event Private Sub OnTableControlCurrentCellKeyUp(ByVal sender As Object, ByVal e As GridTableControlKeyEventArgs)


2 - when filling in the fields of the line, the column where it was done Ctrl + L, does not show the value. and so when going %_TableControlCurrentCellValidating doesn't have any value to validate


Attachment: GridGroupingControlDemo_c4f63cfa.zip


SP Sreemon Premkumar Muthukrishnan Syncfusion Team July 21, 2023 04:13 PM UTC

Hi Ricardo,

We have analyzed the sample you provided and found that the reason for the event not getting executed is because the respective event was not declared. Please find the below code snippet,


'Added the Event declaration

AddHandler gridGroupingControl1.TableControlCurrentCellKeyUp, AddressOf OnTableControlCurrentCellKeyUp


We have attached the modified sample, please find it in the attachment.


If you have any queries or concern, please revert to us. We are here to assist you.

Regards,

Sreemon Premkumar M.


Attachment: GridGroupingControl_cad21b58.zip


RA Ricardo Abranches July 21, 2023 04:20 PM UTC

Hello Sreemon

yes i have a question, and it's the most important of all :-)

The purpose of doing Ctr+l is to open a list with the set of records that can be used and chose one.

what happens is that the value that this list returns is not in the grid cell.

 and so when you go to validating the cell is empty.



RA Ricardo Abranches July 21, 2023 04:48 PM UTC

so i press ctrl + l on CustomerID columm

Captura de ecrã 2023-07-21 173448.png

after that it gos into the image above

Captura de ecrã 2023-07-21 173034

Captura de ecrã 2023-07-21 173034.png

and then if fills the row except the colunm where the ctrl + L was pressed

Captura de ecrã 2023-07-21 173448.png




CM Chidanand Murugaiah Syncfusion Team July 24, 2023 05:53 PM UTC

Hi Ricardo Abranches,

Currently, we are analyzing your reported scenerio. We will validate and update you the details on or before July 26, 2023.

We appreciate your patience until then.

Regards,
Chidanand M



CM Chidanand Murugaiah Syncfusion Team July 26, 2023 11:16 AM UTC

Hi Richard Abranches,


Based on the information provided, we analyzed the reported scenerio. When a cell is in edit mode, it contains a text box. The Display Element is not bound to the textbox in WinForms. As a now the text box is empty, if you try to validate the current cell immediately, the value in the text box will be validated, leading to the particular cell being empty. To overcome this issue, you can select the cell and then use the Escape key to exit from the edit mode or set ActivateCurrentCellBehavior to GridActivateAction.DblClickOnCell.


Please refer the below code snippet:

[VB]

gridGroupingControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell 


Please refer to the UG documentation about GridGroupingControl for your reference.

UG Link - https://help.syncfusion.com/windowsforms/gridgrouping/managing-records-and-columns#setting-the-current-cell-activation-behavior


If you have any issues or queries, feel free to reach out to us. We are here to assist you.


Regards,

Chidanand M.



RA Ricardo Abranches July 27, 2023 01:47 PM UTC

it is working. Thanks :-)

Best regards



CM Chidanand Murugaiah Syncfusion Team July 28, 2023 04:32 AM UTC

Hi Ricardo Abranches,


We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out. 



Regards,

Chidanand M




RA Ricardo Abranches replied to Chidanand Murugaiah September 12, 2023 03:41 PM UTC

I apologize for returning to this subject, but there is a situation that I have not yet been able to resolve.


the last column of the grid is read only. The aim is that when you press ENTER or TAB in that column, the grid changes to a new line in insertion mode. I send an example below,


the colunm name is "ValorLinha"


Attachment: GridGroupingControl_cad21b58_(2)_2d7b8b6a.zip


CM Chidanand Murugaiah Syncfusion Team September 13, 2023 02:33 PM UTC

Hi Ricardo Abranches,


Your requirement can be achieved by using the AddNew method in the TableControlCurrentCellKeyUp event. We have modified the sample to meet your requirement. You can find the sample in the attachment.


Kindly refer the below mentioned code snippet:

if(e.TableControl.CurrentCell.ColIndex == 10 && e.Inner.KeyCode == Keys.Enter)

{

    e.TableControl.Table.AddNew();

}

We hope this helps. Please let us know, if need any further assistance.


Regards,

Chidanand M


Attachment: GridGroupingControl_Demo_d1804ad5.zip


RA Ricardo Abranches November 5, 2023 05:12 PM UTC

Hello

I'm returning to this subject, because I still can't "master" the grid

1) Image P1.png - How can I do it so that when leaving the second textbox the first column of the grid is selected


2) Image p2.png - if you click on the combo in column one, and then press ENTER, a grid line is created below the initial one. If you don't click on the combo, this line is not created. This situation only happens in the first row. How can I make the behavior of the first row the same as the rest.


3) Image p3.png - If in the first column of the row you press the Up cursor button, a row is added at the end of the Grid. How can I avoid this situation?


4) Image P4.png - When, after filling in some rows, I click on the button, a row is added at the end of the grid. How can I avoid this situation.


Images and example attached


Attachment: GridGroupingControl_Rma_67337248.zip


CM Chidanand Murugaiah Syncfusion Team November 6, 2023 04:03 PM UTC

Hi Ricardo Abranches,


Could you please provide the reference images you mentioned in the previous response. It will be helpful for us to better understand of your requirement. 


Regards,

Chidanand M.



RA Ricardo Abranches November 6, 2023 04:20 PM UTC

sorry,

here gos the photos


Attachment: Imagens_43e2911b.zip


CM Chidanand Murugaiah Syncfusion Team November 7, 2023 06:58 PM UTC

Hi Ricardo Abranches,

Currently, we are analyzing your requirement. We will validate and update you the details on or before November 09, 2023.

We appreciate your patience until then.

Regards,
Chidanand M.



CM Chidanand Murugaiah Syncfusion Team November 9, 2023 06:01 PM UTC

Hi Ricardo Abranches,


We are little bit unclear about your second query. Could you please explain about your query, do you want to make the behavior of the first row the same as the rest or first column the same as the rest.


By providing this information, we can gain a better understanding of the issue and work towards finding a prompt resolution.


Regards,

Chidanand M.




RA Ricardo Abranches November 15, 2023 10:53 AM UTC

On the contrary, what I need is for the first row to have the same behavior as the following ones.


Regards




CM Chidanand Murugaiah Syncfusion Team November 16, 2023 05:17 PM UTC

Hi Ricardo Abranches,

Currently, we are analyzing your requirement. We will validate and update you the details on or before November 20, 2023.

We appreciate your patience until then.

Regards,



CM Chidanand Murugaiah Syncfusion Team November 20, 2023 07:36 PM UTC

Hi Ricardo Abranches,


Sorry for the inconvenience.

We need more time to analyze your requirement. We consider this as a high priority and will provide an update on or before November 22, 2023.


Regards,

Chidanand M.





CM Chidanand Murugaiah Syncfusion Team November 22, 2023 05:18 PM UTC

Hi Ricardo Abranches,


Please find the response for your queries

How can I do it so that when leaving the second textbox the first column of the grid is selected

Your requirement can be achieved by setting the WantTabKey as false and then Set the focus to the GridGroupingControl in TableControl.KeyUp event.
 

Kindly refer the below code snippet
 

Grid.WantTabKey = false;

 

private void TableControl_KeyUp(object sender, KeyEventArgs e)

{

    if (e.KeyData == System.Windows.Forms.Keys.Tab)

    {

        Grid.TableControl.CurrentCell.Activate(2, 1);

    }

}

 

if you click on the combo in column one, and then press ENTER, a grid line is created below the initial one. If you don't click on the combo, this line is not created. This situation only happens in the first row. How can I make the behavior of the first row the same as the rest.

The first row is the AddNew record. So, if you enter text and then press Enter, it will create a new row. If you want to stop the process, you can set Grid.TableDescriptor.AllowNew to false. This will remove the AddNew row from the grid.

If in the first column of the row you press the Up cursor button, a row is added at the end of the Grid. How can I avoid this situation?

We are unable to replicate this reported scenario, it works as expected. Could you provide the video demonstration or the exact replication procedure which will help us to provide the better solution.

 When, after filling in some rows, I click on the button, a row is added at the end of the grid. How can I avoid this situation.

Based on the provided information, the issue did not occur until some rows were filled. This behavior arises specifically when values are filled in the first row, as it serves as the AddNew Row. To prevent this behavior, you can disable the AddNew Row from the view by setting Grid.TableDescriptor.AllowNew to false.


Please let us know if you have any concerns in this. 


Regards, 

Chidanand M.


Loader.
Up arrow icon