Commit 0b2e4553 by zhaochengxiang

模型列表定位

parent 63e85eb1
...@@ -215,7 +215,7 @@ tr.drop-over-upward td { ...@@ -215,7 +215,7 @@ tr.drop-over-upward td {
} }
.anchor { .anchor {
background-color: #e7f7ff; background-color: #e7f7ff !important;
} }
.m-common { .m-common {
......
import React, { useState, useEffect, useRef, useMemo } from "react"; import React, { useState, useEffect, useRef, useMemo } from "react";
import { Tooltip, Modal, Table, Typography } from 'antd'; import { Tooltip, Modal, Table, Typography } from 'antd';
import SmoothScroll from 'smooth-scroll';
import LocalStorage from 'local-storage'; import LocalStorage from 'local-storage';
import DataGrid from '../../VirtualTable'; import DataGrid from '../../VirtualTable';
...@@ -106,6 +105,7 @@ const ModelTable = (props) => { ...@@ -106,6 +105,7 @@ const ModelTable = (props) => {
const anchorId = getQueryParam(AnchorId, props?.location?.search); const anchorId = getQueryParam(AnchorId, props?.location?.search);
const anchorTimestamp = getQueryParam(AnchorTimestamp, props?.location?.search); const anchorTimestamp = getQueryParam(AnchorTimestamp, props?.location?.search);
const gridRef = useRef();
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
...@@ -248,17 +248,11 @@ const ModelTable = (props) => { ...@@ -248,17 +248,11 @@ const ModelTable = (props) => {
}, [anchorTimestamp]) }, [anchorTimestamp])
useEffect(() => { useEffect(() => {
if (shouldScrollRef.current) { if (shouldScrollRef.current && gridRef.current && offset!==null) {
SmoothScroll('a[href*="#"]'); setTimeout(() => {
gridRef.current.scrollToRow(offset);
const _id = getQueryParam(AnchorId, props.location.search);
var scroll = new SmoothScroll();
var anchor = document.querySelector(`#row-${_id}`);
if (anchor) {
scroll.animateScroll(anchor);
shouldScrollRef.current = false; shouldScrollRef.current = false;
} }, 300)
} }
}) })
...@@ -456,6 +450,7 @@ const ModelTable = (props) => { ...@@ -456,6 +450,7 @@ const ModelTable = (props) => {
return ( return (
<div> <div>
<DataGrid <DataGrid
gridRef={gridRef}
style={{ blockSize: 'calc(100vh - 94px - 37px - 57px - 24px)' }} style={{ blockSize: 'calc(100vh - 94px - 37px - 57px - 24px)' }}
checkable checkable
columns={columns} columns={columns}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment