Skip to content

Commit

Permalink
FIX: Table view not synchronizing with map view search dropdown (#2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomask committed Oct 5, 2023
1 parent a8a3b21 commit 05c7506
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend-html/src/gui/Components/ScreenElements/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ export class RawTable extends React.Component<ITableProps & { isVisible: boolean
// TODO: Refactor to take real scrollbar sizes
//const freeColIndex = columnIdx + this.fixedColumnCount;
const {gridDimensions} = this.props;
const SCROLLBAR_SIZE = 20;
const SCROLLBAR_SIZE = 24;
const ROW_HEIGHT = 25;
if (this.elmScroller) {
const top = gridDimensions.getRowTop(rowIdx);
const bottom = gridDimensions.getRowBottom(rowIdx);
Expand All @@ -295,9 +296,12 @@ export class RawTable extends React.Component<ITableProps & { isVisible: boolean
if (top - this.elmScroller.scrollTop < 0) {
this.elmScroller.scrollTo({scrollTop: top});
}
if (bottom - this.elmScroller.scrollTop > this.contentBounds.height - SCROLLBAR_SIZE) {
if (
bottom - this.elmScroller.scrollTop > this.contentBounds.height -
SCROLLBAR_SIZE
) {
this.elmScroller.scrollTo({
scrollTop: bottom - this.contentBounds.height + SCROLLBAR_SIZE,
scrollTop: bottom - this.contentBounds.height + SCROLLBAR_SIZE + ROW_HEIGHT ,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { getFormScreenLifecycle } from "model/selectors/FormScreen/getFormScreen
import _ from "lodash";
import { getDataView } from "model/selectors/DataView/getDataView";
import { getSelectedRowId } from "model/selectors/TablePanelView/getSelectedRowId";
import { getTablePanelView } from "model/selectors/TablePanelView/getTablePanelView";

export class MapObjectsStore {
constructor(private root: MapRootStore) {
Expand Down Expand Up @@ -158,6 +159,7 @@ export class MapObjectsStore {
handleLayerClick(id: string) {
if (this.setup.isReadOnlyView) {
getDataView(this.dataView).setSelectedRowId(id);
getTablePanelView(this.dataView).scrollToCurrentRow();
this.search.selectSearchResultById(id);
this.navigationStore.highlightSelectedSearchResult();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.
import { action, computed, observable } from "mobx";
import { IMapObject } from "./MapObjectsStore";
import { MapRootStore } from "./MapRootStore";
import { getDataView } from "model/selectors/DataView/getDataView";
import { getTablePanelView } from "model/selectors/TablePanelView/getTablePanelView";

export class SearchStore {
constructor(private root: MapRootStore) {
}

get dataView() {
return this.root.dataView;
}

get navigationStore() {
return this.root.mapNavigationStore;
}
Expand Down Expand Up @@ -148,6 +154,8 @@ export class SearchStore {

@action.bound
handleSearchResultClick(event: any, resultId: string) {
getDataView(this.dataView).setSelectedRowId(resultId);
getTablePanelView(this.dataView).scrollToCurrentRow();
this.selectSearchResultById(resultId);
this.navigationStore.fitToSelectedSearchResult();
this.navigationStore.highlightSelectedSearchResult();
Expand Down

0 comments on commit 05c7506

Please sign in to comment.