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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Commit row and navigate to first column of New Row

Thread ID:

Created:

Updated:

Platform:

Replies:

121133 Nov 13,2015 02:01 AM UTC Nov 18,2015 12:42 PM UTC WPF 7
loading
Tags: SfDataGrid
Brett Klopfer
Asked On November 13, 2015 02:01 AM UTC

Hi,

When the TAB key is pressed, it moves the cell from left to right. When the last focusable cell is reached and the TAB key is pressed, it commits any changes and navigates to the first column of the next row.

This works well for my users when the datagrid has pre existing rows.

When the user is adding data to a new row (AddRow = Bottom), I need to commit the row changes and navigate to the Add New Row again with the cell focused at the first column.

Any help on how to achieve this would be great.

Regards,

Sowndaiyan Paulpandi [Syncfusion]
Replied On November 13, 2015 05:58 AM UTC

Hi Brett,

Thanks for contacting Syncfusion Support.


We have analyzed your query and you can achieve your requirement “Commit row and navigate to first column of New Row” by overriding the GridSelectionController class and setting it to the SfDataGrid.SelectionController property.

We have prepared a work around sample as per your requirement and you can download the sample form the following KB location,

KB Link : https://www.syncfusion.com/kb/4736/how-to-move-the-currentcell-to-the-first-column-of-the-addnewrow-when-the-tab-key-is-pressed-from-the

Please let us know if you need further assistance.

Regards,
Sowndaiyan





Brett Klopfer
Replied On November 15, 2015 11:31 PM UTC

Hi,

I have downloaded your sample provided, however it does not compile against SF libraries 13.3.0.12. (errors in CustomSelectionController.cs Lines 32, 56)

After I made some changes to your code to get it to compile, it works ok.

In my application, often the last columns are not editable or focusable because they are auto calculated totals, etc. If I change your sample application to have the last column as AllowFocus = False, the tab key navigation stops working.

Regards

Brett

Sivakumar R [Syncfusion]
Replied On November 16, 2015 08:00 AM UTC

Hi Brett,

Sorry for the inconvenience caused. Please find the modified sample from below location,
http://www.syncfusion.com/downloads/support/directtrac/general/ze/WPF1042640007.zip

KB also modified to work with latest version,

Thanks,
Sivakumar

Brett Klopfer
Replied On November 16, 2015 10:55 PM UTC

Hi,

Thank you for the update. The code now compiles and works.

However, if I set the last column in the datagrid to AllowFocus="False", the tab key behaviour doesn't go to the new line.

<syncfusion:SfDataGrid Name="SfdataGrid"
                       AddNewRowPosition="Bottom"
                       AllowFiltering="True"
                       AllowDraggingColumns="True"
                       AllowEditing="True"
                       SelectionMode="Single"
                       ColumnSizer="Auto"
                       AutoGenerateColumns="False"
                       ItemsSource="{Binding Employee}"
                       NavigationMode="cell">
            <syncfusion:SfDataGrid.Columns>
                <syncfusion:GridTextColumn HeaderText="Employee ID" MappingName="EmployeeID" AllowFocus="True" />
                <syncfusion:GridTextColumn HeaderText="Employee Name" MappingName="Name" />
                <syncfusion:GridTextColumn MappingName="NationalIDNumber" />
                <syncfusion:GridTextColumn MappingName="ContactID" />
                <syncfusion:GridTextColumn MappingName="Title"  />
                <syncfusion:GridDateTimeColumn MappingName="HireDate" />
                <syncfusion:GridDateTimeColumn MappingName="BirthDate" />
                <syncfusion:GridNumericColumn MappingName="Salary" AllowFocus="False" />
            </syncfusion:SfDataGrid.Columns>
        </syncfusion:SfDataGrid>

Regards,

Brett

Sowndaiyan Paulpandi [Syncfusion]
Replied On November 17, 2015 09:33 AM UTC

Hi Brett,

We have analyzed your query. We have prepared a sample to achieve your requirement and you can download the sample from the following location,

Sample Location : http://www.syncfusion.com/downloads/support/forum/121133/ze/TAB_Key_Sample1632028930    
 
In this sample, we have moved the CurrentCell position to next focused column based on the GridColumn.AutoFocus property.

Regards,
Sowndaiyan


Brett Klopfer
Replied On November 17, 2015 10:23 AM UTC

Hi,

It still doesn't work as I expect.

When I am in the AddNewRow and the last column is set to not focusable, the tab key goes back to the first column on the AddNewRow.

All I want is when I am ADDING a new row on the AddNewRow and press TAB on the last focusable column, the row is committed and the focus is bought back to the first column on the NEW AddNewRow row.

Sowndaiyan Paulpandi [Syncfusion]
Replied On November 18, 2015 12:42 PM UTC

Hi Brett,

Sorry for the inconvenience caused.


We have analyzed your query. We have prepared a sample to achieve your requirement and you can download the sample from the following location,

Sample Location : http://www.syncfusion.com/downloads/support/forum/121133/ze/TAB_AddNewRow851091578

Please let us know if you need further assistance.

Regards,
Sowndaiyan




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;