How you can access the true value of the selected list item or radio button directly from ADF

Friday, July 25, 2008

ADF manages the selected value of the list item internally and the value that is exposed through the list binding itself is only the index number of the selection in the list. Developers often make the mistake of treating the value of the list binding as one of these expected values and trying to write code or expressions based on that. The simplest way to gain direct access to the true value of an attribute that is populated from a list binding is to create a secondary value binding to the underlying data. This secondary binding can then be used within expressions to access the true value of the attribute.

Details can be found here.

Read more...

How to override the sort behavior of table column

Wednesday, July 23, 2008

Add following code to managed bean that is accessed from the table's sort listener. In this example, whenever users try to sort on the DepartmentName by clicking onto the table header, the sort criteria is modified to DepartmentId .

import java.util.ArrayList;
import java.util.List;

import oracle.adf.view.faces.component.core.data.CoreTable;
import oracle.adf.view.faces.event.SortEvent;
import oracle.adf.view.faces.model.SortCriterion;


public class Sortbean {
public Sortbean() {
}

public void onSort(SortEvent sortEvent) {

List sortList = sortEvent.getSortCriteria();
SortCriterion sc = (SortCriterion) sortList.get(0);

//override sort by DepartmentName and make it sort by DepartmentId instead
if (((String)sc.getProperty()).equalsIgnoreCase("DepartmentName")){
System.out.println("You wanted to sort " +sc.getProperty());

sortList = new ArrayList();
SortCriterion sc2 = new SortCriterion("DepartmentId",true);
System.out.println("This is what I want you to sort for "+sc2.getProperty());
sortList.add(sc2);

CoreTable ct = (CoreTable)sortEvent.getComponent();
ct.setSortCriteria(sortList);
}
}
}

Read more...

Refreshing Table after Inline Delete

To refresh a table data after inline delete, add the following code after delete logic in managed bean.

AdfFacesContext.getCurrentInstance().addPartialTarget(TableId)

Read more...

ADF Component Library with Example

Tuesday, July 15, 2008

ADF 10g Tag Library
ADF 11g Tag Library

Read more...

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP