I’m stuck on whether/how to use the new Table element. I want to show a grid, which would seem to be a Table use case. However my grid has a variable size in both directions, both vertically (one row per player on a field) and horizontally (number of periods in the practice).
Annotated screenshot attached.
Background: the screen shows players in an afternoon sports practice and tells them what jersey color they should wear in each period. The club manager uses this to assign colors ahead of the practice and then publishes the grid to the players.
Database types I have:
Practice object
- has details about the practice like location
Practice Row object, ie players that have opted into this practice
- which player
- which practice
Practice Cell object
- which Practice Row
- which Period (an option set of integers 1 to 12)
- which Color (an option set with R / B / G / W / and empty)
Two questions.
Question 1 - should I be implementing a Table instead of two nested RGs?
I currently do one RG to create the rows. And then inside each, I create another RG to go horizontally for the cells. The horizontal RG uses an option group that has integers 1-12 so that it creates a full grid of cells even if no cell entries exist yet for each player.
I have a separate RG for the column headers.
This all seems like a perfect use case for a Table. Except I couldn’t figure out how to make the table columns repeating. Tables seem like they’re designed to be variable only in the rows direction.
Question 2: what workflow architecture to make performance not suck?
The user flow is the manager taps a cell to cycle between the color assignments. The problem is each tap takes >1 sec to complete because the workflow logic is so cumbersome. Right now the workflows are:
- When clicked, do a search to see if the database has a value already for that cell, and if not make it R
- When clicked, do a search to see if the database has an “R” value already for that cell, and if change that value to “B”
- When clicked, do a search to see if the database has a “B” value already for that cell, and if so change that value to “G”
- …etc, one for each color option
Each workflow is 3 database hits, and each click triggers 6 workflows, so it seems like a lot of things happening each click and thus a poor design.
Thank you in advace! Really loving Bubble so far. Coming from a django background.