Individual Repeater row height

Hi,

I have a dynamic panel within my repeater row which is a different height depending on what state is showing. Is there a way to set the height of the individual repeater row from an onclick event?

For example button 1 sets dynamic panel state and sets repeater row height to X.

Actually even if this is possible i’m not sure its what i’m trying to achieve.

Basically Im using a repeater to add individual items which would be the parents. Once a parent is added I want to add subitems as. The amount of sub items will vary.

Once a parent is added the form to add another is moved below the last added parent. This would all need to move if subitems were added to a parent.

Parent 1

  • Child 1
  • Child 2
  • Add another child item

Add another parent

Yes, in the repeater properties, ensure the “Fit to Content in HTML” checkbox is selected. Then, in your dynamic panel properties, ensure the “Fit to Content” checkbox is selected. In the OnClick event, change the state of your dynamic panel and the row height should change automatically to the height of the content in the current state.

With your original question it sounds like you’re thinking of representing children–or more exactly the number of children–as dynamic panel states. Seems like that could work, with reasonable limitation of how many children can be added. Or, are you thinking that one state is for Parent and second state is for Child, with different heights for each? That would certainly be possible and probably quite efficient. In addition to your content column, include a “level” or “relationship” column to track whether an item is a parent or child. Your “Add another child item” button would trigger an Add Row action with the name of the child and set it’s “level” value to “child”. The OnItemLoad event would change the state of your dynamic panel based on the value in the “level” column, thus controlling the height of the row. Likewise for adding a parent, just set the “level” column value to “parent”.

That might be a little harder to achieve, but maybe you could also have a column to control the sort order of the repeater rows. Clicking the “add another” row could update its own “sorted” column value in addition to adding a new row, such that it would be moved to the bottom-most slot within its level.

OK… This was kind of fun to try out. See this demo file which has varying heights for parent and child rows and allows adding and removing rows with the requirement that the “add item” rows always appear at the bottom of their corresponding level. Is this what you were after?

Repeater Size and Hierarchy with Add Item.rp (99.0 KB)

Great response as always @mbc66

Its exactly what i’m looking for. Im just trying to achieve one more thing which is to either move or only show a button on the second to last row of the repeater. This would move or show on a different row as more rows were added to the repeater.

row 1
row 2 (button)
row 3
Add row

row 1
row 2
row 3 (button)
row 4
Add row

Is there a condition I can add to the button onload event within the row to only show if its second to last row within repeater?

This can be done by using the [[Item.index]] and [[Item.visibleItemCount]] variables, where you would set up a comparison of the current index to the number of items (or visible items in case any filters might be applied) minus 2.

See this updated file where I created this on Page 1.
Repeater Size and Hierarchy with Add Item.rp (286.6 KB)

Notice this always shows the button on the second-to-last row, regardless of item level. If you want to show a button on the second-to-last row within the parent and child levels, then you need some way to track the order of items within levels. My approach here is to use another column to control when to show the “special button” and assign this value as “true” if the item’s Order value is 2 less than the “Add item” row (which should always be the last row within a level.) This logic got more complex than I expected, especially if rows can be deleted, but it does work. See this on Page 2.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.