Ticket T1283052
Visible to All Users

dxDataGrid: Unexpected Scrolling When Setting focusedRowIndex with autoNavigateToFocusedRow=false

created 6 months ago

Hello DevExpress Support Team,
I am experiencing an issue with the DevExtreme DataGrid where setting focusedRowIndex causes the grid to scroll to the focused row, even though autoNavigateToFocusedRow is set to false. Based on the documentation, the grid should not automatically navigate when autoNavigateToFocusedRow is disabled.
Below is a simplified example that reproduces the issue:

JavaScript
$(() => { let grid = $('#gridContainer').dxDataGrid({ dataSource: generateData(100000), keyExpr: 'id', focusedRowEnabled: true, autoNavigateToFocusedRow: false, showBorders: true, customizeColumns(columns) { columns[0].width = 70; }, loadPanel: { enabled: true, }, scrolling: { mode: 'virtual', }, sorting: { mode: 'none', }, onContentReady(e) { e.component.option('loadPanel.enabled', false); setTimeout(() => e.component.option('focusedRowIndex', 100), 1000); }, }).dxDataGrid('instance'); });

Answers approved by DevExpress Support

created 6 months ago

Hello Andreu,

Thank you for the code snippet.

This behavior is expected. autoNavigateToFocusedRow affects only the focusedRowKey behavior, not focusedRowIndex. When you specify focusedRowKey, the grid can simply set focusedRowIndex to -1 if the focused row is outside its viewport. Conversely, when specifying focusedRowIndex, the grid needs to navigate to the focused row to load and set focusedRowKey.

In this case, I recommend that you specify focusedRowKey instead of focusedRowIndex to prevent the grid from navigating to the focused row. If this doesn't help, please describe your usage scenario in greater detail. I will check if there is an alternative.

Regards,
Mark

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.