X

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

  • ADFv
    January 20, 2012

Adding checkboxes to sortable table headers

Frank Nimphius
Master Principal Product Manager

Using the header facet of the af:column tag, developers can add components to the table header, for example to indicate the component to be excluded from printing or export to Excel. The side effect of adding a command item to a table header is when the table column is sortable.

In this case, selecting the component, for example an instance of af:selectBooleanCheckBox , will also trigger sorting on the table, which you don't want to happen until users explicitly ask for this.

The solution to this problem is JavaScript added to the checkbox components and the use of stopBubbling() to prevent user the click event to reach the table header and then the sort icons.

<af:resource type="javascript">
   function stopBubbling(evt){
      evt.stopBubbling();
  }
</af:resource>

The JavaScript is called from the checkbox as shown below

<af:selectBooleanCheckbox id="sbc2" text="FirstName"                                                           
value="..." autoSubmit="true"><af:clientListener method="stopBubbling" type="click"/>
</af:selectBooleanCheckbox>

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.