Tag Archives: snippet

How To in Jdeveloper ADF Tutorials – creates new row in af:panelist


Scenario:

How to make a panellist that reads data from a database and according to the number of records in the database creates new row in the panellist?

Solution:


<af:iterator id="i3" value="#{emp.collectionModel}" var="row"> //emp.collectionModel is your collection
          <af:panelList id="pl1">
            <af:outputText value="#{row.empName}" id="ot3"/> // empName is the attribute to show
          </af:panelList>
        </af:iterator>

How To in Jdeveloper ADF Tutorials- reset the inputText component values


Sometimes the value of the inputText component is not refreshed and the value that was previously entered will still persist within the component. To overcome this issue. we have to use the resetValue() method to reset the component value and display the components intial state

What it does:

  • Get handle to the inputText component using the JSFUtils find component method with the inputText id passed as a parameter
  • set the submitted value of the inputText as null
  • reset’s the input component value
  • refresh the component
private void resetInputText(String id) { 
RichInputText input = (RichInputText)JSFUtils.findComponentInRoot(id); 
input.setSubmittedValue(null); 
input.resetValue(); 
AdfFacesContext.getCurrentInstance().addPartialTarget(input); 
}

Usage:

This method is used to reset the inputText component value’s in a popup, af:formlayout, af:table.

How to select entire row using checkbox


To select all the rows in a table design a page like

 

 

 

 

 

 

create a binding to the table, the valuechangelistener of the checkbox will have the following code


 

 

 

 

 

working example can be downloaded from

http://adfproject.googlecode.com/files/SelectAllRowsInATable.zip

Snippet to check if the transaction is dirty


We can use the following code snippet to check if the transaction is dirty or not

BindingContext bctx = oracle.adf.controller.binding.BindingUtils.getBindingContext();
if (bctx.findDataControlFrame(bctx.getCurrentDataControlFrame()).isTransactionDirty()) {
 //show the timestamp
 }
 else{
 //don't show
 }