Platinum Solutions Corporate Website


Customizing Table Selection Events in ADF/UIX

The answer you entered to the math problem is incorrect.

The ADF framework boasts some pretty sweet built-in functionality when it comes to user driven events. However, the table selection functionality that is currently built-in has some potential for improvement. When a user selects a specific row, there are a number of potential scenarios that I may want to code for. For example, I may want to do a combination of the following:

  • Refresh one or more tables based on the user's selection.
  • Update the URL of a button’s action with one or more parameters from the selected row.
  • Fill out additional input components on the page.
  • Perform validation on the user’s selection. For example, if the user selects a row to either delete or edit. We can perform custom validation to see if that row meets specific criteria.
  • Set a value into the session.

ADF/UIX simply does not have the built-in functionality to efficiently handle a combination of these events. With this in mind, I recommend creating a custom Java event with the combination of Oracle’s Partial Page Refreshing to handle the action of a user selecting a row in a UIX table. Let’s take a look at how to do this.

Within the UIX tags of your table, you will need to look for the tag. This is the only tag that you need to change on the UIX page. Within this tag, you need to change two attributes; the first attribute is targets. Within this attribute you need to specify the ID of each UIX component you wish to perform PPR on. Also, make sure you leave a space between each component as well as the _uixState as the last string in the quotes. The second attribute is the event attribute. This needs to be changed to the name of your custom event in the action class that corresponds to the UIX page.

Once the UIX page is configured, we can then create our method in the action class. Please note that you will need to know the UIX ID attribute of your table as well as the name of the table’s iterator. The best way to show you this is by looking at the code. Our method should look something like this:

public void onMySelect(DataActionContext actionContext)
{

  //grab the instance of the table
  ServletRequestDataSet tableDataSet = new
  ServletRequestDataSet(actionContext.getHttpServletRequest(),
  "theIdOfTheTableInTheUixPage");

  //get the index of the row that the user has selected
  int selectedIndex = SingleSelectionBean.getSelectedIndex(tableDataSet);

  //find the iterator associated with the table
  JUIteratorBinding itBinding =
  ((JUIteratorBinding) actionContext.getBindingContainer()
  .findNamedObject("theTablesIterator"));

  //set the iterators row equal to the row that the user has selected
  itBinding.setCurrentRowIndexInRange(selectedIndex);

  //make sure the selected row is valid
  if (itBinding.getCurrentRow() != null)
  {
    //perform all necessary actions on the selected row.
  }
}

After looking at the above, I hope that it is apparent that the above solution will provide you with a customized, yet scalable approach when dealing with UIX table interactions.

Comments

Post new comment

Please solve the math problem above and type in the result. e.g. for 1+1, type 2.
The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options