openalloc / SwiftTabler

A multi-platform SwiftUI component for tabular data
Apache License 2.0
136 stars 14 forks source link

For List-based table types, support header/footer outside scrolling region #48

Open reedes opened 2 years ago

reedes commented 2 years ago

...so the header and/or footer can be independent of the scrolling of the rows. Currently they are inside the scrolling region for these table types, because otherwise there are issues with alignment in the layout.

Header/footer should be independently configurable. See the commented code for Stack- and Grid-based tables. Move the config to the TablerConfig base class so it can be shared by all the table types.

Any conditional views (bounded by if blocks) need to be tested and analyzed to ensure they don't affect scalability.

JackOSheaDev commented 11 months ago

Hello, was this ever implemented into the library ?

reedes commented 11 months ago

Nothing that I've done.

IIRC it was tricky getting the margin right in the header/footer, so I gave up.

There might have been changes to SwiftUI since that have made it possible, but that'll require someone else to pursue and submit a pull request.

JackOSheaDev commented 11 months ago

Nothing that I've done.

IIRC it was tricky getting the margin right in the header/footer, so I gave up.

There might have been changes to SwiftUI since that have made it possible, but that'll require someone else to pursue and submit a pull request.

Thank you for the quick response, I'm currently doing a project for college using the library so I was wondering if it was possible, I might try to attempt making the header fixed or calculate the number of rows that can be shown on screen and use pagination instead of scrolling.

reedes commented 11 months ago

You can try forking the library and modify BaseList (or the selection variants) to place the header and footer builders outside the List block.

See how it's done on BaseGrid and BaseStack. A VStack wrapper may be necessary.

Then use padding as necessary to get things to align. Not ideal, but may be easier than paging!

JackOSheaDev commented 11 months ago

I'll give that a try thank you ! It also seems like TablerStack works for my use case, but the header styling is slightly different using the default settings.