Skip to content

Commit b594e6b

Browse files
committed
- set rangeSelectionMode property to data grid components
- set isShiftClick property to useRowSelection react hook update function
1 parent 1590df8 commit b594e6b

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

web/pgadmin/static/js/components/PgReactDataGrid.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function CustomRow({inTest=false, ...props}) {
119119

120120
return (
121121
<Row {...props} onKeyDown={handleKeyDown} onCellClick={onCellClick} onCellDoubleClick={onCellDoubleClick}
122-
selectCell={(row, column)=>props.selectCell(row, column)} aria-selected={isRowSelected}/>
122+
selectCell={(row, column)=>props.selectCell(row, column)} aria-selected={isRowSelected} rangeSelectionMode={true}/>
123123
);
124124
}
125125
CustomRow.propTypes = {
@@ -158,6 +158,7 @@ export default function PgReactDataGrid({gridRef, className, hasSelectColumn=tru
158158
renderSortStatus,
159159
noRowsFallback: <Box textAlign="center" gridColumn="1/-1" p={1}>{noRowsIcon}{noRowsText || gettext('No rows found.')}</Box>,
160160
}}
161+
enableRangeSelection={true}
161162
{...props}
162163
/>
163164
</GridContextUtils.Provider>

web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function CustomRow(props) {
116116
};
117117
return (
118118
<RowInfoContext.Provider value={rowInfoValue}>
119-
<Row ref={rowRef} onKeyDown={handleKeyDown} {...props} />
119+
<Row ref={rowRef} onKeyDown={handleKeyDown} {...props} rangeSelectionMode={true}/>
120120
</RowInfoContext.Provider>
121121
);
122122
}
@@ -305,9 +305,9 @@ function RowNumColFormatter({row, rowKeyGetter, rowIdx, dataChangeStore, onSelec
305305
} else if(rowKey in (dataChangeStore?.deleted || {})) {
306306
rownum = rownum+'-';
307307
}
308-
return (<div className='QueryTool-rowNumCell' onClick={()=>{
308+
return (<div className='QueryTool-rowNumCell' onClick={(e)=>{
309309
onSelectedColumnsChange(new Set());
310-
onRowSelectionChange({ type: 'ROW', row: row, checked: !isRowSelected, isShiftClick: false});
310+
onRowSelectionChange({ type: 'ROW', row: row, checked: !isRowSelected, isShiftClick: (e.nativeEvent).shiftKey});
311311
}} onKeyDown={()=>{/* already taken care by parent */}}>
312312
{rownum}
313313
</div>);

0 commit comments

Comments
 (0)