An advancedTable is capable of HTTP Post opearation hence while creating an advancedTable be sure that it’s a recursive child of the pageLayout region and the “Form” property of the pageLayout region is set to “True”.
All the events generated by advancedTable are HTTP requests are can be caught and handled in processFormRequest method of the controller.
Some of the events of advancedTable can be summarized as below:
Navigation – Occurs when a user clicks on the “next” or “previous” link on the top of the table to navigate to other set of rows than that being currently displayed in the advancedtable region.
Sorting – Occurs when a user selects a highlighted column heading to sort that column in ascending or descending order.
Insertion of a new row – A very important event in advancedTable and it occurs once a user clicks the “Add Another Row” button.
Recalculate column Total – Another important event and this one occurs once a user selects the Recalculate button to update the column total.
Detail Disclosure – this event occurs once the user selects the Hide or Show link to collapse or expand the detail disclosure region.
All the events that get fired by advancedTable can be captured using the hidden fields that are UIX attributes in the UIConstants interface. These hidden fields are parameters that are set once an event is fired by advancedTable region.
The parameters can be summarized as:
SOURCE_PARAM: This parameter designates the event source, in other words, this is the parameter which tells the source from which an event has been fired or generated. It has the name attribute of the webbean that has produced the event.
To check whether the event has been generated by table just refer the lines below
if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM)))
{
….Your business logic to handle the condition
}
EVENT_PARAM: This is the parameter which tell that which event has been generated, the possible list of values that this parameter can have is:
- GOTO_EVENT– this is the value of the EVENT_PARAM when a user clicks on the “next” or “previous” link of the advancedTable.
- SORT_EVENT: as the name suggests that this value pertains to the event when a user clicks on a sort-able column for ascending or descending order of values.
- HIDE_EVENT: EVENT_PARAM attains this value when the “Hide” link of a detail disclosure is selected.
- SHOW_EVENT: EVENT_PARAM attains this value when the “Show” link of a detail disclosure is selected.
- ADD_ROWS_EVENT: once the user clicks on the “Add Another Row” button the EVENT_PARAM gets this value.
- UPDATE_EVENT: The pressing of “Recalculate” button generates this value.
- VALUE_PARAM: This is a different type of parameter which tracks the value relevant to a particular event. Let’s discuss this further.
- When a hide show in a detail disclosure is selected then this parameter has the value of the row index whose corresponding hide/show link was selected.
- When “next” or “previous” link on top of the advancedTable is selected then this parameter has the value of index of the first row that is currently being displayed on the screen e.g. suppose your advanced table displays 12 rows at once, now when the advancedTable region is loaded initially to display the first 12 rows then VALUE_PARAM has the value of 1. Once the next link is clicked and the advancedTable region displays rows from 13 to 24 (if available) then the VALUE_PARAM has the value of 13.
SIZE_PARAM: This parameter indicates the number of rows that are currently being displayed by the table. This parameter gets the value only in the case of navigation event and is applicable to navigation event only.
STATE_PARAM: This parameter is used to indicate the current sorted state of the column, hence applicable only for sort event.
A Small event handling example:
Suppose you want to check if the Add Another Row button has been clicked on the AdvancedTable then you just need to write a code similar to the one shown below:
if (advancedTableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM)))
&& ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
{
.. Your business logic as per the requirement
}
Hope that you find this post to be informative…
Thanks for reading 🙂