Skip to content

Commit

Permalink
Add infinite scrolling
Browse files Browse the repository at this point in the history
CannonLock committed Dec 18, 2023

Verified

This commit was signed with the committer’s verified signature.
1 parent 529f8bc commit d5d4b96
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/pages/maps/@id/edit/components/main.module.sass
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@
position: relative

.width-adjustable-panel-content
display: flex
flex-direction: column
overflow: scroll
height: 100%
flex-grow: 1
14 changes: 13 additions & 1 deletion src/pages/maps/@id/edit/edit-table.ts
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ export default function TableInterface({ url }: EditTableProps) {
const [copiedColumn, setCopiedColumn] = useState<string | undefined>(undefined)

// Data State
const [dataParameters, setDataParameters] = useState<DataParameters>({select: {page: "0", pageSize: "99"}, filter: {}})
const [dataParameters, setDataParameters] = useState<DataParameters>({select: {page: "0", pageSize: "50"}, filter: {}})
const [data, setData] = useState<any[]>([])

// Error State
@@ -338,6 +338,9 @@ export default function TableInterface({ url }: EditTableProps) {
onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
tabIndex: 0,
style: {
minHeight: "0"
}
}, [
h("div.table-container", {}, [
h.if(error != undefined)("div.warning", {}, [error]),
@@ -378,6 +381,15 @@ export default function TableInterface({ url }: EditTableProps) {
setSelectedColumn(undefined)
}
},
onVisibleCellsChange: (visibleCells) => {

console.log(visibleCells)
if(visibleCells["rowIndexEnd"] > parseInt(dataParameters.select.pageSize) - 10){
const newPageSize = (parseInt(dataParameters.select.pageSize) + 50).toString()

setDataParameters({...dataParameters, select: {...dataParameters.select, pageSize: newPageSize}})
}
},
numRows: data.length,
// Dumb hacks to try to get the table to rerender on changes
cellRendererDependencies: [data, tableUpdates],

0 comments on commit d5d4b96

Please sign in to comment.