mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-27 16:57:00 -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-aspen": "^1.1.0",
|
||||
"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-draggable": "^4.4.4",
|
||||
"react-leaflet": "^3.2.2",
|
||||
|
@ -324,6 +324,7 @@ def panel(trans_id):
|
||||
return render_template(
|
||||
"sqleditor/index.html",
|
||||
close_url=close_url,
|
||||
title=params['title'],
|
||||
params=json.dumps(params),
|
||||
requirejs=True,
|
||||
basejs=True,
|
||||
|
@ -63,6 +63,8 @@ function setPanelTitle(panel, title, qtState, dirty=false) {
|
||||
title = title.slice(0, -1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
title = qtState.params.title;
|
||||
}
|
||||
|
||||
title = title + (dirty ? '*': '');
|
||||
|
@ -382,7 +382,7 @@ function getTextWidth(column, rows, canvas, columnWidthBy) {
|
||||
}
|
||||
|
||||
export default function QueryToolDataGrid({columns, rows, totalRowCount, dataChangeStore,
|
||||
onSelectedCellChange, rowsResetKey, selectedColumns, onSelectedColumnsChange, columnWidthBy, ...props}) {
|
||||
onSelectedCellChange, selectedColumns, onSelectedColumnsChange, columnWidthBy, ...props}) {
|
||||
const classes = useStyles();
|
||||
const [readyColumns, setColumns] = useState([]);
|
||||
const eventBus = useContext(QueryToolEventsContext);
|
||||
@ -394,7 +394,7 @@ export default function QueryToolDataGrid({columns, rows, totalRowCount, dataCha
|
||||
useEffect(()=>{
|
||||
let initCols = initialiseColumns(columns, rows, totalRowCount, columnWidthBy);
|
||||
setColumns(formatColumns(initCols, dataChangeStore, selectedColumns, onSelectedColumnsChangeWrapped, props.rowKeyGetter, classes));
|
||||
}, [columns, rowsResetKey]);
|
||||
}, [columns]);
|
||||
|
||||
useEffect(()=>{
|
||||
setColumns((prevCols)=>{
|
||||
@ -440,6 +440,5 @@ QueryToolDataGrid.propTypes = {
|
||||
selectedColumns: PropTypes.objectOf(Set),
|
||||
onSelectedColumnsChange: PropTypes.func,
|
||||
rowKeyGetter: PropTypes.func,
|
||||
rowsResetKey: PropTypes.any,
|
||||
columnWidthBy: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
};
|
||||
|
@ -747,7 +747,7 @@ export function ResultSet() {
|
||||
}
|
||||
fireRowsColsCellChanged();
|
||||
};
|
||||
const [rowsResetKey, setRowsResetKey] = useState(true);
|
||||
const [rowsResetKey, setRowsResetKey] = useState(0);
|
||||
|
||||
rsu.current.setEventBus(eventBus);
|
||||
|
||||
@ -778,10 +778,10 @@ export function ResultSet() {
|
||||
if(goForPoll) {
|
||||
rsu.current.pollForResult(
|
||||
(procQueryData, procColumns, procRows)=>{
|
||||
setRowsResetKey((prev)=>prev+1);
|
||||
setQueryData(procQueryData);
|
||||
setColumns(procColumns);
|
||||
setRows(procRows);
|
||||
setRowsResetKey(!rowsResetKey);
|
||||
},
|
||||
(planJson)=>{
|
||||
/* 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_auto_resize
|
||||
}
|
||||
rowsResetKey={rowsResetKey}
|
||||
key={rowsResetKey}
|
||||
rowKeyGetter={rowKeyGetter}
|
||||
onScroll={handleScroll}
|
||||
onRowsChange={onRowsChange}
|
||||
|
@ -9069,9 +9069,9 @@ react-checkbox-tree@^1.7.2:
|
||||
nanoid "^3.0.0"
|
||||
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"
|
||||
resolved "git+https://github.com/adityatoshniwal/react-data-grid.git/#8074ba4a31f3a320c50a17b6c5b528d9afd2b5de"
|
||||
resolved "git+https://github.com/adityatoshniwal/react-data-grid.git/#8d9bc16ddd7c419acfbbd1c1cc2b70eb9f5b453c"
|
||||
dependencies:
|
||||
clsx "^1.1.1"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user