How to conditionally enable / disable the column contents in the ADF 11g table

Scenario: I have below contents in my table –

In the “Remove Attachment” column have Delete Icon when clicked, it will deletes the record. I want to Enable this Delete Icon based on the Condition. Then it will look as below –

Solution: To achieve the above functionality follow below steps –

Step 1: Create a Transient atribute in your View Object (VO) that is used in the table as shown

a)      Double click on the View Object.

b)      Go to Attributes section in the View Object.

c)      Click on the New Attribute option as shown  –

       d) In the “New View Object Attribute” window give the name for the Transient atribute, I have used “IsRemoveAttachmentEnabled” as Name. In the same window, under Updatable section, select the “Always” radio button. By default this option will be with “Never” and Click “OK” as shown –

          e) Now the new Transient attribute (“IsRemoveAttachmentEnabled”) will get created in the View Object as shown

Step 2: Refresh the Data Control and you can see the newly added Transient attribute under the View Object as shown –

Step 3: Now you need to add this transient attribute (“IsRemoveAttachmentEnabled”) to your Bindings in the JSPX page.

             a)  Go to your JSPX bindings section and select the iterator (AttachmentsVO1) that you were using for your table to display the records.

             b) Select the Iterator and click on the Edit icon as shown in the above screen shot and “Edit Tree Bindings” window will be displayed. “Under Available Attributes” section select the newly created Transient attribute and move it to the “Display Attributes” section as shown below. Now you will be able to access the Transient variable in your JSPX page.

Step 4: Now to include the conditional logic create a method in the Managed bean as shown below


   * Set values on transient attributes, set read-only indicators, etc.  Called by View, Copy, and Reverse listeners
   * @param
  public void enableRemoveAttachment() {
                BindingContext bc = BindingContext.getCurrent();
                DCBindingContainer bindings = (DCBindingContainer)bc.getCurrentBindingsEntry();
              // Get the Attachments iteraor
              DCIteratorBinding glIter = bindings.findIteratorBinding(“AttachmentsVO1“);
                if (glIter != null && glIter.getRowSetIterator().getRowCount() > 0) {
                    RowSetIterator rsi = glIter.getViewObject().createRowSetIterator(null);
                    Row glRow;
                    while ( != null) {
                        glRow = rsi.getCurrentRow();
                        // Set “rendered” indicators
                        if (Your_Conditional_Logic){
                                    glRow.setAttribute(“IsRemoveAttachmentEnabled”, “false“);
                          glRow.setAttribute(“IsRemoveAttachmentEnabled”, “true“);
      }catch(Exception e){
        throw new RuntimeException(e);

In the above method (enableRemoveAttachment()) based on your condition you are setting the values (true, false) to the Transient attribute for each row in the iterator. This Transient attribute value we will use for RENDERED parameter for the column, where we want to conditionally display the column contents in the table in JSPX page.

In my case, I have done as below –

<af:column id=”c8″ headerText=”Remove Attachment” align=”center” width=”80″>
                <af:commandImageLink id=”cil1″
                                     text=” “

By doing this way, based on the Transient attribute values (true, false) the Command link under the “Remove Attachment” column is Rendered and the outcome is as below –

The above approach can be used for any other parameter in the ADF tags, such as “read-only” etc.

If you want to call the method “enableRemoveAttachment()” from Managed Bean before the JSPX page loads, to know how to call a method on JSPA page loads click here

This entry was posted in ADF (Application Development Framework) and tagged , , , , , , , . Bookmark the permalink.

3 Responses to How to conditionally enable / disable the column contents in the ADF 11g table

  1. ILya Cyclone says:

    Hi there,
    Nice post. I only wonder what is the difference between #{row.bindings.IsRemoveAttachmentEnabled.inputValue} and #{row.IsRemoveAttachmentEnabled} ?
    Both would give the same resault as far as I know.

  2. veeresh says:

    Hi Udaya,

    nice post, I dint understand one thing.

    from where the method enableRemoveAttachment() will be called to updat the transient variable value.


    • JohnCena says:

      Hi Veeresh

      #{row.bindings.IsRemoveAttachmentEnabled.inputValue} is for editable fields
      #{row.IsRemoveAttachmentEnabled} – for read only like output text

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s