How to adjust the width and height of a repeating panels

Hello,

I’m desperately trying to adjust the size of a repeating panel I have linked to a search button that pulls data from a data table. The code works fine but it is populating the contents in a standard width on the page and cramming everything together!

There is no option in the GUI to change the box height and width (please add this) and after reading several forms it looks like my only option is CSS. I’ve added the following code but to no avail. It does seem to be recognizing it but in trying width or min-width it either stays the same or makes it smaller.
I’d like to be able to have my repeating panel adjust based on the data inside the table but if that’s not possible then I’d like to at least have it at a default size that doesn’t have all text crammed together.

Code Sample:


self.NetSearchPanel_1.role = 'size'

CSS

.anvil-role-size {  /* For NetSearch repeating panel */
 /* min-height: 1000px; */
 /* width: 500px; */
  min-width: 1000px;
}


Clone link:
share a copy of your app

Not 100% because I don’t use repeating panels often, but from playing around with somethings in repeating panels and item templates, I think you have to set these things in the item template rather than in the repeating panel. How you would do that depends on what components you have in the item template. To get advice on that, sharing a Clone link would help.

Beside that, the only thing I can see to change in the repeating panel to change would be the col_spacing to make it bigger.

2 Likes

Clone link below. I don’t see a way to set a role to a ItemTemplate but I maybe missing something.

https://anvil.works/build#clone:TONRTQDXKQ4CH3V2=UFJD3FAH5UWGTIECAVDRGENW

You don’t need to play with roles.
The non intuitive part is that you need to select a component to change its container’s behavior.
You need to select the repeating panel and check the full_width_row to tell its container to show it full width.
Then you need to do the same with one of the labels inside the template form.

  1. Go to the form NetSearch
  2. Select the repeating panel NetSearchPanel_1
  3. Check full_width_row in the CONTAINER PROPERTIES section
  4. Double click on the repeating panel to edit ItemTemplate4
  5. Select any of the labels
  6. Check full_width_row in the CONTAINER PROPERTIES section

PS: I assume your question was about “how to make a repeating panel full width”.
If this is the case, can you please edit the title, so it will help others?
If this is not the case, then can you please explain what you mean?


PPS: In case you didn’t know, clone links include all your tables and their content

1 Like

Thanks for sharing the clone, that gives more context. A few things I can see:

  1. Since your itemtempates that I could see that were active are a number of labels, to change the relative width of each field, you can use the IDE to expand/contract the width of the labels
  2. For the height of the template since its all a single row, I think without roles its just dependent on the number of rows you have

Hello,

The full_width_row was helpful but not ideal. I’d like to be able to control the width of each column in the panel and not just take up the whole screen. :slight_smile:

How can I take more control of each box in a repeating panel? Also, words aren’t wrapping correctly in the repeating panel. For instance, the site address.

Thanks for the help!

You can adjust column widths by dragging the vertical separators.
Ctrl+drag gives finer control.
Double click resets all the column widths to equally distributed.
The column widths are not exposed in the form editor. I sometimes clone the git repository to my computer and play around with the column widths that are available in the form’s yaml file.
image

Using data grids you have slightly better control over column widths. The repeating panels contained inside a data grid get the column widths from the columns defined in the data grid, where you can assign the width to some columns and leave other columns flexible.

The word wrapping in a label happens where there are spaces. If you have long texts without spaces, the text in a label will not wrap and spill into the next column. So, if you have one label that may end up with text that doesn’t unwrap well, you will need to either add spaces to the text or make sure it’s wide enough.

1 Like