@@ -184,7 +184,7 @@ export function DatabaseActions({table, numSelectedRows, allowInsert, setTable,
184
184
</ > ) ;
185
185
}
186
186
187
- function DatabasePageControls ( { offset, maxRows, rowCount, setOffset} ) {
187
+ function DatabasePageControls ( { position , offset, maxRows, rowCount, setOffset} ) {
188
188
// Returns a text string with row count information for the table
189
189
function totalRowCountText ( offset , maxRows , rowCount ) {
190
190
// Update the end value if it's pointing past the last row
@@ -202,31 +202,53 @@ function DatabasePageControls({offset, maxRows, rowCount, setOffset}) {
202
202
return offset . toLocaleString ( ) + "-" + end . toLocaleString ( ) + " of " + rowCount . toLocaleString ( ) + " total rows" ;
203
203
}
204
204
205
+ // Adjust the style of the border for top vs bottom control placement
206
+ let bRadius ;
207
+ if ( position === "bottom" ) {
208
+ bRadius = "0 0 7px 7px" ;
209
+ } else {
210
+ bRadius = "7px 7px 0 0" ;
211
+ }
212
+
205
213
return (
206
214
< div className = "row" >
207
215
< div className = "col-md-12" >
208
- < div style = { { maxWidth : "100%" , overflow : "auto" , border : "1px solid #DDD" , borderRadius : "0 0 7px 7px" } } >
216
+ < div style = { { maxWidth : "100%" , overflow : "auto" , border : "1px solid #DDD" , borderRadius : bRadius } } >
209
217
< table className = "table table-responsive" style = { { margin : 0 } } >
210
218
< thead >
211
219
< tr >
212
- < th style = { { textAlign : "center" , padding : 0 } } >
220
+ < th style = { { textAlign : "center" , padding : 0 , borderBottom : "1px" } } >
213
221
{ offset > 0 ? ( < >
214
222
< span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
215
- < a href = "#" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( 0 ) } data-cy = "firstpgbtn" > ⏮</ a >
223
+ < a href = "#" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( 0 ) } data-cy = "firstpgbtn" > < i className = 'fa fa-fast-backward' style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i > </ a >
224
+ </ span >
225
+ < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
226
+ < a href = "#" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( offset - maxRows ) } data-cy = "pgupbtn" > < i className = 'fa fa-backward' style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 2px 2px 0" } } > </ i > </ a >
227
+ </ span >
228
+ </ > ) : ( < >
229
+ < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
230
+ < i className = 'fa fa-fast-backward' style = { { color : "white" , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i >
216
231
</ span >
217
232
< span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
218
- < a href = "#" style = { { color : "black " , textDecoration : "none" } } onClick = { ( ) => setOffset ( offset - maxRows ) } data-cy = "pgupbtn" > ⏴ </ a >
233
+ < i className = 'fa fa-backward' style = { { color : "white " , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 2px 2px 0" } } > </ i >
219
234
</ span >
220
- </ > ) : null }
221
- < span style = { { verticalAlign : "middle" } } > { totalRowCountText ( offset , maxRows , rowCount ) } </ span >
235
+ </ > ) }
222
236
{ offset + maxRows < rowCount ? ( < >
223
237
< span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
224
- < a href = "#" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( offset + maxRows ) } data-cy = "pgdnbtn" > ⏵️</ a >
238
+ < a href = "#" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( offset + maxRows ) } data-cy = "pgdnbtn" > < i className = 'fa fa-forward' style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 0 2px 2px" } } > </ i > </ a >
239
+ </ span >
240
+ < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
241
+ < a href = "#" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( rowCount - maxRows ) } data-cy = "lastpgbtn" > < i className = "fa fa-fast-forward" style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i > </ a >
242
+ </ span >
243
+ </ > ) : ( < >
244
+ < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
245
+ < i className = 'fa fa-forward' style = { { color : "white" , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 0 2px 2px" } } > </ i >
225
246
</ span >
226
247
< span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
227
- < a href = "# " style = { { color : "black " , textDecoration : "none" } } onClick = { ( ) => setOffset ( rowCount - maxRows ) } data-cy = "lastpgbtn" > ⏭ </ a >
248
+ < i className = "fa fa-fast-forward " style = { { color : "white " , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i >
228
249
</ span >
229
- </ > ) : null }
250
+ </ > ) }
251
+ < span style = { { verticalAlign : "middle" } } > { totalRowCountText ( offset , maxRows , rowCount ) } </ span >
230
252
</ th >
231
253
</ tr >
232
254
</ thead >
@@ -483,7 +505,10 @@ export default function DatabaseView() {
483
505
deleteSelectedRows = { confirmDeleteSelectedRows }
484
506
insertRow = { insertRow }
485
507
/>
508
+ < DatabasePageControls position = "top" offset = { offset } maxRows = { maxRows } rowCount = { rowCount } setOffset = { ( newOffset ) => changeView ( table , newOffset , sortColumns . length ? sortColumns [ 0 ] . columnKey : null , sortColumns . length ? sortColumns [ 0 ] . direction : null ) } />
486
509
< DataGrid
510
+ // The "+ 1" includes the header row. The 35 is the default row height size in pixels.
511
+ style = { { height : ( ( maxRows + 1 ) * 35 ) + "px" , overflow : "hidden" } }
487
512
className = "rdg-light"
488
513
renderers = { { noRowsFallback : < DataGridNoRowsRender /> } }
489
514
columns = { columns }
@@ -499,7 +524,7 @@ export default function DatabaseView() {
499
524
resizable : true
500
525
} }
501
526
/>
502
- < DatabasePageControls offset = { offset } maxRows = { maxRows } rowCount = { rowCount } setOffset = { ( newOffset ) => changeView ( table , newOffset , sortColumns . length ? sortColumns [ 0 ] . columnKey : null , sortColumns . length ? sortColumns [ 0 ] . direction : null ) } />
527
+ < DatabasePageControls position = "bottom" offset = { offset } maxRows = { maxRows } rowCount = { rowCount } setOffset = { ( newOffset ) => changeView ( table , newOffset , sortColumns . length ? sortColumns [ 0 ] . columnKey : null , sortColumns . length ? sortColumns [ 0 ] . direction : null ) } />
503
528
< div className = "row" style = { { border : "none" } } > </ div >
504
529
< DatabaseFullDescription description = { meta . fullDescription } />
505
530
< div className = "row" style = { { border : "none" } } > </ div >
0 commit comments