X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFm
    January 11, 2012

Display selected table row number and total rows

Frank Nimphius
Master Principal Product Manager
A question on OTN was how to display the current row number
and the number of totally available rows in a formatted output string. In the
example used below, the format is
row no. [<row index>] of max rows [<total numbers of rows>]

For this example, I used an af:outputText component to
display the information on the page. The value of the af:outputText component is calculated from expression language (EL)
accessing the ADF binding layer as shown below. Note that for better readability the EL includes line breaks, which in your application you should not add.

 row no. [

#{(bindings.allDepartmentsIterator.rangeStart
< 0 ?

1 : bindings.allDepartmentsIterator.rangeStart+1) +

(
bindings.allDepartmentsIterator.currentRowIndexInRange == -1 ?

0 :
bindings.allDepartmentsIterator.currentRowIndexInRange)}
]

of max rows[

#{bindings.allDepartmentsIterator.estimatedRowCount}]

Note
how the expression uses the iterator binding in the ADF binding layer to determine
the maximum number of table rows. It then uses the same iterator to determine
the current row. Because iterators are zero based, the EL uses additional logic
to compensate this.

The af:outputText component needs to have its PartialTriggers property pointing the the af:table component ID to ensure the displayed information is refreshed when the table row currency changes.

 <af:outputText value="row no. [#{(bindings.allDepartmentsIterator.rangeStart &lt; 0 ? 1  :  bindings.allDepartmentsIterator.rangeStart+1) +( bindings.allDepartmentsIterator.currentRowIndexInRange ==  -1 ? 0 : bindings.allDepartmentsIterator.currentRowIndexInRange)}] of max rows [#{bindings.allDepartmentsIterator.estimatedRowCount}]"
                id="ot1" partialTriggers="pc1:t1"/>


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.