@@ -184,7 +184,7 @@ export function DatabaseActions({table, numSelectedRows, allowInsert, setTable,
184184 </ > ) ;
185185}
186186
187- function DatabasePageControls ( { offset, maxRows, rowCount, setOffset} ) {
187+ function DatabasePageControls ( { position , offset, maxRows, rowCount, setOffset} ) {
188188 // Returns a text string with row count information for the table
189189 function totalRowCountText ( offset , maxRows , rowCount ) {
190190 // Update the end value if it's pointing past the last row
@@ -202,31 +202,53 @@ function DatabasePageControls({offset, maxRows, rowCount, setOffset}) {
202202 return offset . toLocaleString ( ) + "-" + end . toLocaleString ( ) + " of " + rowCount . toLocaleString ( ) + " total rows" ;
203203 }
204204
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+
205213 return (
206214 < div className = "row" >
207215 < 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 } } >
209217 < table className = "table table-responsive" style = { { margin : 0 } } >
210218 < thead >
211219 < tr >
212- < th style = { { textAlign : "center" , padding : 0 } } >
220+ < th style = { { textAlign : "center" , padding : 0 , borderBottom : "1px" } } >
213221 { offset > 0 ? ( < >
214222 < 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 >
216231 </ span >
217232 < 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 >
219234 </ span >
220- </ > ) : null }
221- < span style = { { verticalAlign : "middle" } } > { totalRowCountText ( offset , maxRows , rowCount ) } </ span >
235+ </ > ) }
222236 { offset + maxRows < rowCount ? ( < >
223237 < 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 >
225246 </ span >
226247 < 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 >
228249 </ span >
229- </ > ) : null }
250+ </ > ) }
251+ < span style = { { verticalAlign : "middle" } } > { totalRowCountText ( offset , maxRows , rowCount ) } </ span >
230252 </ th >
231253 </ tr >
232254 </ thead >
@@ -483,7 +505,10 @@ export default function DatabaseView() {
483505 deleteSelectedRows = { confirmDeleteSelectedRows }
484506 insertRow = { insertRow }
485507 />
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 ) } />
486509 < 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" } }
487512 className = "rdg-light"
488513 renderers = { { noRowsFallback : < DataGridNoRowsRender /> } }
489514 columns = { columns }
@@ -499,7 +524,7 @@ export default function DatabaseView() {
499524 resizable : true
500525 } }
501526 />
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 ) } />
503528 < div className = "row" style = { { border : "none" } } > </ div >
504529 < DatabaseFullDescription description = { meta . fullDescription } />
505530 < div className = "row" style = { { border : "none" } } > </ div >
0 commit comments