Tuesday, September 28, 2010

How to reference the value in a ADF Table column declaratively and in Java

I am correcting myself. I think I could not find a way to reference the value in a ADF table column using EL outside the table component.

As we all know, the value in the column of ADF table is referenced by using EL "#{row.AttributeName}", while "row" is defined in the ADF table component attribute - "Var" by default. If there is a scenario that you have to reference the value outside of the table: for example, you have a button outside of the table and will be dynamically disabled if a value in the table is null and enabled if a value is not null. The question is, how you gonna reference the column value out of the table.

Using the IteratorBinding EL is not accessible, I was trying to use #{Bindings.IteratorName.AttributeName.inputValue} to reference the value but it failed, since it is not the way it should be referenced. It is a attribute of the active Iterator binds to the table so simply it should be using the attribute binding. When drag and drop the view object to be exposed as an ADF table, the pageDef file adds the treeBinding as the Binding type for the table. So if we need to reference the value in the table, we need to create an attributeBinding, and simply reference its value by using EL: "#{Bindings.AttributeName.inputValue}".

Also we can reference it in Java. My previous post did this by utilizing the automatic binding of the UI component in a managed bean, by calling the method getSelectedRowData() or getValue() on the ADF table. Here I demonstrate just by calling the getControlBinding("IteratorName") from the Binding Container. In the method, I pass the name of the view object iterator in the data control that binds with the ADF table. Actually calling getControlBinding() from BindingContainer or getValue() from the binding table component did the exact same thing behind the scene.

Here is the code in Java:

1 comment:

Mussolini Boss said...

How to import data From Excel file Into an ADF Table !