Skip to content

Commit

Permalink
DataGrid - The focused state of a row with the 0 key should be restor…
Browse files Browse the repository at this point in the history
…ed (T1252962) (#28180)
  • Loading branch information
markallenramirez authored Oct 18, 2024
1 parent f795096 commit a63b980
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,31 @@ test('The rows should render correctly when cellTemplates are used and the selec
// simulating async rendering in React
await makeRowsViewTemplatesAsync(GRID_CONTAINER);
});

test('The focused state of a row with the 0 key should be restored (T1252962)', async (t) => {
const dataGrid = new DataGrid('#container');
const dataRow0 = dataGrid.getDataRow(0);

// assert
await t
.expect(dataGrid.isReady())
.ok()
.expect(dataRow0.isFocusedRow)
.ok();
}).before(async () => createWidget('dxDataGrid', {
dataSource: [
{ id: 0, text: 'item 1' },
{ id: 1, text: 'item 2' },
],
keyExpr: 'id',
focusedRowEnabled: true,
stateStoring: {
enabled: true,
type: 'custom',
customLoad() {
return Promise.resolve({
focusedRowKey: 0,
});
},
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const stateStoring = (Base: ModuleType<StateStoringController>) => class StateSt

if (this.option('focusedRowEnabled')) {
this.option('focusedRowIndex', -1);
this.option('focusedRowKey', state.focusedRowKey || null);
this.option('focusedRowKey', state.focusedRowKey ?? null);
}

this.component.endUpdate();
Expand Down

0 comments on commit a63b980

Please sign in to comment.