Pages

Dynamic table height with the autoHeightRows property

Our use case was to have a table displaying data, with under this table some content. The content needed to be directly under the last table row. In ADF 12c this goes a lot better, but in ADF 11g, the table takes up some default space. 

I recreated this on a HR example application: 

ADF has a cool feature which can help in situations like this, it’s called ‘autoHeightRows’.  In the documentation of the af:table we can find the following information about this property: ‘The height of the component can grow to a maximum of 'autoHeightRows' after which a scrollbar is displayed.’

So if in the above example the autoHeightRows would be set to 2, we get the following result:

This is getting close to what we want, but if we would navigate to a different department, the table would still be incorrect, department 30 has only 6 rows in the table, which should be displayed without a scrollbar:

Luckily the autoHeightRows can also be defined by an expression. This means we can use the rangeSize to define this autoHeightRows property, after which the table will be stretched to the correct amount of rows:



No comments:

Post a Comment