Tuesday, November 2, 2010

ADF UI - Setting default display rows to some fixed number (Removing extra space in tables)

When you use af:table to display data, then by default the table will occupy more space than actually required (See image below).

In the above image, the table contains just two rows, but it's taking more space than required. To avoid that, we need to set table's ContentDelivery="immediate" and AutoHeightRows="<some_fixed_number>". See code below:
<af:table value="#{bindings.EmpDeptVO.collectionModel}" var="row" rows="#{bindings.EmpDeptVO.rangeSize}" emptyText="#{bindings.EmpDeptVO.viewable ? 'No data to display.' : 'Access Denied.'}" fetchSize="#{bindings.EmpDeptVO.rangeSize}" rowBandingInterval="0" selectedRowKeys="#{bindings.EmpDeptVO.collectionModel.selectedRow}" selectionListener="#{bindings.EmpDeptVO.collectionModel.makeCurrent}" rowSelection="single" id="t1" partialTriggers=":::qryId1 ::ctb1" columnStretching="column:c1" styleClass="AFStretchWidth" columnSelection="multiple" first="0" contentDelivery="immediate" autoHeightRows="10">

From the above code, we can see that ContentDelivery="immediate" and AutoHeightRows="10". If we set this, if the no. of rows in the table are above 10, it'll just show first 10 rows. We need to scroll down to see the next rows. And, if the no. of rows in the table are below 10, the table just shows only that many no. of rows without any extra space (see image below).

1 comment:

Related Posts with Thumbnails