Using a dynamic table (See Below) it tries to place all but the last 2 items of the table onto a single page and then the last two rows are placed on a new page. I have tried removing the display: flex; and flex-direction: row; components of the CSS and it returns to page breaking normally, but i lose out on the desired effect of having the text being centered vertically on the page.
The reason why this happen is because the pagination routines of OL Connect doesn’t work when the CSS display: flex; has been applied to the <table>-element.
Your container has a fixed height, so it will always fit on the page regardless of the amount of content it has. Pagination will not kick in. You will get similar behavior with display:block, although then the content will obviously not be centered.
If you remove display:flex the container will revert back to display:table and the fixed height will be ignored (browser limitation). This means the container will grow with its content. Now pagination will kick in.
Going back to your use case, if content does not fit inside a fixed-height container you want to duplicate that container and distribute content between the original and its copy. This needs to be scripted. There is no built-in feature in Connect that allows content to flow from one fixed-height element to another.
The overflows() script function should be helpful.
@Sander here is an update of the code I am using as of this morning, It is getting me almost entirely there, except for a few test records which still seem to break the pagination (ones that stretch more than 2 pages)
HTML:
The overflow method makes sense and seems the key to solving my remaining problems. I think the piece I am unsure about is how to ensure the content spreads over new pages. Will I need to dynamically clone the page somehow? I know how to do that with overall sections, but not pages within a section. Copying the table container itself feels like it would still cause the same issue.
@SamSorenson if the container element is inline (not absolute positioned) and as large as the page, you could duplicate it in your script and Connect’s pagination algorithm should automatically create another page and push the copy to that page. Then you would still need a way to distribute content between the container elements. It is probably doable, but I’m afraid it will not be easy.
How about this instead:
Since your data is suitable for a table, start with a regular dynamic table (inline, no fixed height). If the table does not fit on the page, Connect’s pagination algorithm ensures it is split into multiple tables. Then you use a post pagination script to wrap each table in a display:flex container that aligns the content. You can prepare these containers on your master page.
Not sure if that will fit your use case, but here is a POC: AlignCenter.zip (7.4 KB)
Use the JSON sample data feature to import the json file.