I am trying to do something I think should be possible, but I cannot find any way to do it. Since a picture is worth a thousand words, I’ve included a diagram of what I’m trying to do.
The orange box is a repeater. Each item in the repeater is linked to a dataset for table (called Red, here), column price. The purple box is where my troubles start. I need to map a 1:n relationship. Each row in Table green has 1 price. Table Red price can exist on many Green’s.
What I really want is to create my own repeater inside a repeater. But…according to Wix documentation, you can’t put a repeater in a repeater. It is suggested to use a table instead.
I want to display two columns in Green:
- item
- Special instructions.
Not all items in Green have special instructions. (in fact MOST don’t. only a few do). If I put them in a second column in a table, it looks TERRIBLE. Most of the page is empty/wasted space.
I want special instructions, if they exist, to be aligned underneath “Item”.
The problem with tables is that their formatting is REALLY limited. For example, text in different columns can’t look different. All columns have the same font/size/etc. Even if it could work for me to put “special instructions” into another column, and make the font much smaller, I can’t do that.
Another option might be to create a derived field from Green.item and Green.special_instructions. Something like concat “item \n instructions”. I’d probably need to concatenate and create html…something like this:
and then create custom CSS to style each div.
Maybe I could generate a single HTML string with the query for ALL Green items in group Red, and then I wouldn’t need a repeater inside a repeater. I could just display the string (if I can display the rendered HTML)
Is this possible? Is this my only option? If so, what is the typical way to create derived columns? Using hooks? Can you use a derived column as a column in a table? Can that derived column have custom formatting? Can it be HTML instead of just plain text?
This all seems hacky…
If someone has a better idea, I’d love to hear it.
Thank you