mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where the data grid scroll is not reset when a query is executed.
This commit is contained in:
parent
955bb22cd1
commit
aaab5c51a7
@ -152,7 +152,7 @@
|
|||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-aspen": "^1.1.0",
|
"react-aspen": "^1.1.0",
|
||||||
"react-checkbox-tree": "^1.7.2",
|
"react-checkbox-tree": "^1.7.2",
|
||||||
"react-data-grid": "git+https://github.com/adityatoshniwal/react-data-grid.git/#8074ba4a31f3a320c50a17b6c5b528d9afd2b5de",
|
"react-data-grid": "git+https://github.com/adityatoshniwal/react-data-grid.git/#8d9bc16ddd7c419acfbbd1c1cc2b70eb9f5b453c",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-draggable": "^4.4.4",
|
"react-draggable": "^4.4.4",
|
||||||
"react-leaflet": "^3.2.2",
|
"react-leaflet": "^3.2.2",
|
||||||
|
@ -324,6 +324,7 @@ def panel(trans_id):
|
|||||||
return render_template(
|
return render_template(
|
||||||
"sqleditor/index.html",
|
"sqleditor/index.html",
|
||||||
close_url=close_url,
|
close_url=close_url,
|
||||||
|
title=params['title'],
|
||||||
params=json.dumps(params),
|
params=json.dumps(params),
|
||||||
requirejs=True,
|
requirejs=True,
|
||||||
basejs=True,
|
basejs=True,
|
||||||
|
@ -63,6 +63,8 @@ function setPanelTitle(panel, title, qtState, dirty=false) {
|
|||||||
title = title.slice(0, -1);
|
title = title.slice(0, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
title = qtState.params.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
title = title + (dirty ? '*': '');
|
title = title + (dirty ? '*': '');
|
||||||
|
@ -382,7 +382,7 @@ function getTextWidth(column, rows, canvas, columnWidthBy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function QueryToolDataGrid({columns, rows, totalRowCount, dataChangeStore,
|
export default function QueryToolDataGrid({columns, rows, totalRowCount, dataChangeStore,
|
||||||
onSelectedCellChange, rowsResetKey, selectedColumns, onSelectedColumnsChange, columnWidthBy, ...props}) {
|
onSelectedCellChange, selectedColumns, onSelectedColumnsChange, columnWidthBy, ...props}) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [readyColumns, setColumns] = useState([]);
|
const [readyColumns, setColumns] = useState([]);
|
||||||
const eventBus = useContext(QueryToolEventsContext);
|
const eventBus = useContext(QueryToolEventsContext);
|
||||||
@ -394,7 +394,7 @@ export default function QueryToolDataGrid({columns, rows, totalRowCount, dataCha
|
|||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
let initCols = initialiseColumns(columns, rows, totalRowCount, columnWidthBy);
|
let initCols = initialiseColumns(columns, rows, totalRowCount, columnWidthBy);
|
||||||
setColumns(formatColumns(initCols, dataChangeStore, selectedColumns, onSelectedColumnsChangeWrapped, props.rowKeyGetter, classes));
|
setColumns(formatColumns(initCols, dataChangeStore, selectedColumns, onSelectedColumnsChangeWrapped, props.rowKeyGetter, classes));
|
||||||
}, [columns, rowsResetKey]);
|
}, [columns]);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
setColumns((prevCols)=>{
|
setColumns((prevCols)=>{
|
||||||
@ -440,6 +440,5 @@ QueryToolDataGrid.propTypes = {
|
|||||||
selectedColumns: PropTypes.objectOf(Set),
|
selectedColumns: PropTypes.objectOf(Set),
|
||||||
onSelectedColumnsChange: PropTypes.func,
|
onSelectedColumnsChange: PropTypes.func,
|
||||||
rowKeyGetter: PropTypes.func,
|
rowKeyGetter: PropTypes.func,
|
||||||
rowsResetKey: PropTypes.any,
|
|
||||||
columnWidthBy: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
columnWidthBy: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||||
};
|
};
|
||||||
|
@ -747,7 +747,7 @@ export function ResultSet() {
|
|||||||
}
|
}
|
||||||
fireRowsColsCellChanged();
|
fireRowsColsCellChanged();
|
||||||
};
|
};
|
||||||
const [rowsResetKey, setRowsResetKey] = useState(true);
|
const [rowsResetKey, setRowsResetKey] = useState(0);
|
||||||
|
|
||||||
rsu.current.setEventBus(eventBus);
|
rsu.current.setEventBus(eventBus);
|
||||||
|
|
||||||
@ -778,10 +778,10 @@ export function ResultSet() {
|
|||||||
if(goForPoll) {
|
if(goForPoll) {
|
||||||
rsu.current.pollForResult(
|
rsu.current.pollForResult(
|
||||||
(procQueryData, procColumns, procRows)=>{
|
(procQueryData, procColumns, procRows)=>{
|
||||||
|
setRowsResetKey((prev)=>prev+1);
|
||||||
setQueryData(procQueryData);
|
setQueryData(procQueryData);
|
||||||
setColumns(procColumns);
|
setColumns(procColumns);
|
||||||
setRows(procRows);
|
setRows(procRows);
|
||||||
setRowsResetKey(!rowsResetKey);
|
|
||||||
},
|
},
|
||||||
(planJson)=>{
|
(planJson)=>{
|
||||||
/* No need to open if plan is empty */
|
/* No need to open if plan is empty */
|
||||||
@ -1272,7 +1272,7 @@ export function ResultSet() {
|
|||||||
queryToolCtx.preferences.sqleditor.column_data_max_width :
|
queryToolCtx.preferences.sqleditor.column_data_max_width :
|
||||||
queryToolCtx.preferences?.sqleditor?.column_data_auto_resize
|
queryToolCtx.preferences?.sqleditor?.column_data_auto_resize
|
||||||
}
|
}
|
||||||
rowsResetKey={rowsResetKey}
|
key={rowsResetKey}
|
||||||
rowKeyGetter={rowKeyGetter}
|
rowKeyGetter={rowKeyGetter}
|
||||||
onScroll={handleScroll}
|
onScroll={handleScroll}
|
||||||
onRowsChange={onRowsChange}
|
onRowsChange={onRowsChange}
|
||||||
|
@ -9069,9 +9069,9 @@ react-checkbox-tree@^1.7.2:
|
|||||||
nanoid "^3.0.0"
|
nanoid "^3.0.0"
|
||||||
prop-types "^15.5.8"
|
prop-types "^15.5.8"
|
||||||
|
|
||||||
"react-data-grid@git+https://github.com/adityatoshniwal/react-data-grid.git/#8074ba4a31f3a320c50a17b6c5b528d9afd2b5de":
|
"react-data-grid@git+https://github.com/adityatoshniwal/react-data-grid.git/#8d9bc16ddd7c419acfbbd1c1cc2b70eb9f5b453c":
|
||||||
version "7.0.0-beta.12"
|
version "7.0.0-beta.12"
|
||||||
resolved "git+https://github.com/adityatoshniwal/react-data-grid.git/#8074ba4a31f3a320c50a17b6c5b528d9afd2b5de"
|
resolved "git+https://github.com/adityatoshniwal/react-data-grid.git/#8d9bc16ddd7c419acfbbd1c1cc2b70eb9f5b453c"
|
||||||
dependencies:
|
dependencies:
|
||||||
clsx "^1.1.1"
|
clsx "^1.1.1"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user