mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Scrolling to the active record on search
Summary: Two bugs fixed: 1. On search, when the first result is in the active record, GridView wasn't scrolling to the active record. 2. When an active record was not visible, GridView wasn't scrolling to the active record when the column index was changed. The problem was that the scrolling behavior was based only on rowIndex which isn't changed (and doesn't notify subscribers) when a column index changes or when the search highlights a cell. This diff makes the computed depend also on the fieldIndex, and is introducing a new method that can scroll to the active record on demand (which is used by the search). Test Plan: Updated tests. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3191
This commit is contained in:
@@ -309,9 +309,12 @@ class FinderImpl implements IFinder {
|
||||
// this ad-hoc way rather than use observables, to avoid the overhead of *every* cell
|
||||
// depending on an additional observable.
|
||||
await delay(0);
|
||||
const viewInstance = await waitObs<any>(section.viewInstance);
|
||||
const viewInstance = (await waitObs(section.viewInstance))!;
|
||||
await viewInstance.getLoadingDonePromise();
|
||||
if (this._aborted) { return; }
|
||||
// Make sure we are at good place. This is important when the cursor
|
||||
// was already in a matched record, but the record was scrolled away.
|
||||
await viewInstance.revealActiveRecord();
|
||||
|
||||
const cursor = viewInstance.viewPane.querySelector('.selected_cursor');
|
||||
if (cursor) {
|
||||
|
||||
Reference in New Issue
Block a user