How to size a table subview

As shown in the screenshot below, I have a subview for a table defined but it is much taller than I’d like it to be. I’ve tried setting the defaultSize.height property on the subview’s view itself but that seems to have no effect. There seem to be no settings for the subview size in the rows.subview properties in the Table itself. If it matters, the subview’s root container is a Flex container.

Am I missing something or is there just no way to change the height of a subview?

1 Like

I have also same issue but I use table as subview to list more detailed rows.

Also using Flex container

It would be nice that there could be possibility to set basis to auto so that it would always the right size

Anyone find a solution to this?

I implemented a table with a subview that contains a table of the related records to the parent table. I would like the subview to somewhat auto-size to the size of the subtable rather than it having a lot of whitespace or forcing scrolling.

1 Like

Set the component’s basis in your embedded subview to auto.


image

small:


expanded (look at the row below the subview; it has been pushed down a little more because the subview grew):

I can’t get it to work for embedded table subviews right now… the auto basis on a table seems to size the component so that only the header is visible.

Did not know about the auto basis, missed that, thanks!

But your right, it does not seem to work with subview tables

Hello everyone,
is there any news about this option in new versions?

Just bumped to 8.1.6 this week and auto-height is subviews seems to work fine now.

I’m in 8.1.4 and it doesn’t work.
I don’t see any change about this point in the Release Notes

Maybe I don’t set basis=auto on the good component.

Ok, so the behavior is weird. I have one page where it works, and another where it doesn’t. However on the one where it doesn’t, the props.data takes a second to run the DB query so it might not re-calculate the height after the rows are loaded.

There was a change to add a rows.height parameter, I think this change made this partially work, but not in all situations. @cmallonee Is this related to FEATURE-16567, or just coincidental?

I'm still new to ignition so maybe this isn't the best way but it works for me.
You can use some scripting to find the amount of instances appended in the dataset of the table to then set the size of the view that contains that table.

The binding is made directly on the table's data property

I used import time to have each row instance appended incrementally on the view for visual effect. You need to also know how to get the necessary cell data from the parent table into the subview table.

The table in the flex container has grow set to 1 so the view's defaultSize.height is only changed

The important code is this:
"""
chute = self.view.params.value.chute
rows = value.getRowCount()
i = 0
size = 30

while i < rows:
chuteTest = value.getValueAt(i, 0)
if chute == chuteTest:
size = size + 50
self.view.props.defaultSize.height = size
i = i + 1

return data
"""

You could have a query tag run the db query and bind the props.data to the query tag and evaluate the data in the binding to check its .getRowCount() and use that to set the view size

I faced the same issue until I changed the table.props.virtualized setting to false in the subview table. Additionally, make sure that the table.position.basis is configured as follows: basis: auto. Now everything works correctly, and the subview will push the rows down as needed.