Can't get a table to focus on the last row on return

I have a table which is indexed on row1.
I have the default index of the table as {{localStorage.values.mIndex}}.
I focus on a particular row and I store row1 of that row to localStorage with the code:
localStorage.setValue ('mIndex', table1.selectedRow.row1);

I check in the debugger and mIndex is saving fine. mIndex is 44.

OK, I leave the table and then come back to it. When I return there is no selected row.

I would like the table to focus or select where row1 = 44 when I return.

Is there a way of doing that?

Mike

Summary

A table is indexed on a 'row1' column and the selected row's row1 value (e.g. 44) is saved to localStorage; on returning to the table, setting the Default row to {{localStorage.values.mIndex}} does not re-select/focus that row.

AI Response

The Default selected row setting expects a positional row index (0-based), not a stored column value like 44, which is why passing mIndex directly doesn't match. Instead, compute the index by finding where the column value equals the stored value, e.g. set the default row to {{ table1.data.findIndex(r => r.row1 == localStorage.values.mIndex) }}. Alternatively, on the table's data load, run table1.selectRow({ mode: 'key', key: localStorage.values.mIndex }) to select by matching value rather than position.

Sources

:bookmark: Select row of table based on table data property
Covers selecting a table row by a data property/ID value rather than by numeric index, matching the goal of re-selecting the row where row1 equals the stored value.
:bookmark: How to Select Table rows programatically?
Solved thread showing how to programmatically select rows with table.selectRow(), which can be triggered on load to focus the stored row.

The Community Team is testing out a new automation. Let us know if it's helpful (or not) by leaving a :heart:, :+1:, or :-1:. Or by marking this post as the "Solution"! Let us know if you have any feedback here. :rocket: