Repeater inside repeater is not supported, but suggested solution (table) does not work.

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:

  1. item
  2. 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:

item
special instructions

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

You can have 1 database, and 2 datasets. With the right filters:

And the 50 category is done similarly to this, just replace filter to 50

How it looks from database:

Is this what you are looking for?

So…If I understand you…you’re suggesting to use one dataset for item…filtered by price. So I don’t actually use a repeater for the price category. I manage it by hand. I make several boxes, each mapped to a different data set filtered by the price group for that box.

In my example, the orange box is a repeater, repeating on price_group.

In your example, the orange box is…just a box. And I have to make as many orange boxes as I have prices (or price_groups) for. I have to do this manually.

This will work in the short term, but is error prone. As soon as someone adds another price or price_group, the UI will be missing the new price and I’ll have to add it manually.

My data looks like this:

Table: price_group
group1: $40: additional information for group1
group2: $40: different additional information for group2
group3: $50:
group4: $50: additional information for group4
group5: $60:

Table: item
item1: name of item1: price_group1:
item2: name of item2: price_group1: additional information for item2
item3: name of item3: price_group2:
item4: name of item4: price_group3: additional information for item4
item5: name of item5: price_group4: additional information for item5
item6: name of item6: price_group_5: <no additional information

I expect to see a repeater for each price group, containing the items for each group…so:

repeater of price_group: first box (orange box above)

group1: $40: additional information for group1
(my desire is to have another repeater here, or a table that doesn’t suck)
item1: name of item1
item2: name of item2: additional information for item2

group2: $40: different additional information for group2
(my desire is to have another repeater here, or a table that doesn’t suck)
item3: name of item3

In your solution, you are effectively doing a GROUP BY price, so you’d have one box for $40 (even though there are two price groups who happen to have the same price of $40…but they have different additional information)

I would have 2 boxes that both have the price of $40. I am not doing a GROUP BY. I am just doing…er…in SQL talk…JOIN price_group ON price_group.id WHERE item.price_group.id = price_group.id.

Your solution works…only sort of…and for only right now…It makes putting special price_group instructions more difficult…It also breaks the moment someone adds a group with a new price, or change an existing price.

Dear Wix…PLEASE…either let me put a repeater inside a repeater, or let me have more control over table formatting.
If you can’t give me nested repeaters, then I want the ability to do this:

$item_name
$item_additional_information

Then in CSS (pseudo code):
class item_name {
font-size: 10pt;
}
class item_additional_information {
font-size: 8pt;
font-style: italic;
}

Then if I were getting even fancier, I would probably do some JS DOM magic to detect a null value for item_additional_information and set display:none so it doesn’t make blank space.

You are talking about it looking horrible, when there is blank space, when it doesn’t show the special instructions (if there are not any)

There is few ways I know that can be used:

  1. Making the #text box so narrow, that when it has more info to show, it will be shown in the next line, (if not additional text present, then not)

  2. Making the items have #additionaltext, but collapsed, and by code, you check whether it is null, or not, whether to expand the additional text.

And I dont get why it is hard to manage:

You can make a admin page for managing, where you set repeater Read & Write, so you can change settings you want to change. Also see the settings you want to see.