Paginate burgs, states, cultures, religions, rivers & routes editors#1469
Paginate burgs, states, cultures, religions, rivers & routes editors#1469barrulus wants to merge 1 commit into
Conversation
|
Much needed changes for maps with complex and large numbers of states.Greatly aids performance and quality! |
f5926b4 to
f8045f0
Compare
|
Good idea, but I don't like the code, has to be "un-vibed". |
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Use the idea, don't use the code |
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Should it be open for a while? We can integrate it when the migration is done. |
|
Happy to keep it open but also happy to redo it once the uk updates are complete. The code is here whether it is open or not! |
|
do you want me to resolve these conflicts now or later? |
f8045f0 to
5513666
Compare
Large editors render every row into the DOM at once, which is slow and unwieldy on big maps (thousands of burgs/routes). This adds shared pagination so each editor renders at most one page (200 rows) at a time. Shared helpers in editors.js: - getEditorPage(data, pageRef, size) clamps the page and returns the slice - sortDataByActiveHeader(header, data, accessors) sorts the FULL dataset by the active column so sorting spans all pages, not just the visible one - renderEditorPagination(footer, info, onGoto) injects prev/next + jump-to controls into the editor footer; hidden when everything fits on one page - bindEditorSortReset(header, onSort) resets to page 1 on a column-sort click Each editor: sorts + totals over the full set, slices the current page for rendering, resets to page 1 on open / filter change / sort, guards row lookups that may target a row on another page, and exports CSV from the data model rather than the (now partial) DOM. The footer pager fills the table width without widening the fit-content dialog. No new HTML/CSS; the pager UI is built in JS.
5513666 to
efe827a
Compare
Renders large editor lists 200 rows at a time so they stay responsive on big maps. The States editor in particular was effectively unusable at 1k+ states because it renders a coat-of-arms per row; it now renders the COA only for the current page.
What changed
editors.js:getActiveSort,sortDataByActiveHeader,getEditorPage,renderEditorPagination,bindEditorSortReset.applySorting), computes footer totals/averages over the full set, then renders only the current page and drawsPage n of Ncontrols in the footer.randomizeStatesExpansionare guarded against rows that aren't on the current page.fit-contentwidth, so narrow dialogs (e.g. Rivers) don't get an empty gutter.Notes
masterbefore this change.Test plan