mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-09 07:33:19 -06:00
Ensure that when pasting rows the rows are added right below the selected rows for copying. #5921
This commit is contained in:
parent
a026353df8
commit
319701dbbd
@ -781,6 +781,7 @@ export function ResultSet() {
|
||||
dispatchDataChange({type: 'reset'});
|
||||
setSelectedRows(new Set());
|
||||
setSelectedColumns(new Set());
|
||||
rsu.current.resetClientPKIndex();
|
||||
setLoaderText(gettext('Waiting for the query to complete...'));
|
||||
return await rsu.current.startExecution(
|
||||
query, explainObject,
|
||||
@ -1207,8 +1208,18 @@ export function ResultSet() {
|
||||
|
||||
useEffect(()=>{
|
||||
const triggerAddRows = (_rows, fromClipboard)=>{
|
||||
let insPosn = 0;
|
||||
if(selectedRows.size > 0) {
|
||||
let selectedRowsSorted = Array.from(selectedRows);
|
||||
selectedRowsSorted.sort();
|
||||
insPosn = _.findIndex(rows, (r)=>rowKeyGetter(r)==selectedRowsSorted[selectedRowsSorted.length-1])+1;
|
||||
}
|
||||
let newRows = rsu.current.processRows(_rows, columns, fromClipboard);
|
||||
setRows((prev)=>[...newRows, ...prev]);
|
||||
setRows((prev)=>[
|
||||
...prev.slice(0, insPosn),
|
||||
...newRows,
|
||||
...prev.slice(insPosn)
|
||||
]);
|
||||
let add = {};
|
||||
newRows.forEach((row)=>{
|
||||
add[rowKeyGetter(row)] = {
|
||||
@ -1222,7 +1233,7 @@ export function ResultSet() {
|
||||
};
|
||||
eventBus.registerListener(QUERY_TOOL_EVENTS.TRIGGER_ADD_ROWS, triggerAddRows);
|
||||
return ()=>eventBus.deregisterListener(QUERY_TOOL_EVENTS.TRIGGER_ADD_ROWS, triggerAddRows);
|
||||
}, [columns]);
|
||||
}, [columns, selectedRows.size]);
|
||||
|
||||
useEffect(()=>{
|
||||
const renderGeometries = (column)=>{
|
||||
|
Loading…
Reference in New Issue
Block a user