Tuesday 17 September 2013

ADF - Customizing Table Row Selection


ADF - Customizing Table Row Selection

If you want to do something cool when a user clicks on a row within a Table, or if you just want to customize what happens when the row is clicked.

I use the JSFUtils class, and I am assuming you have this class in your project.
The ADF Utils can be found in a previous Post here

The Custom Table Row Selection Application is here.

Firstly after you have created the af:Table in the Property Inspector find the Selection Listener. I created my table off the HR Schema.


In the Selection Listener there was
#{bindings.EmployeesView1.collectionModel.makeCurrent}
As the default Value.

and either create a managed Bean or use one of your existing ones, and the same with a method.



I called my method "employeeTableSelectionListener" it accepts one Parameter "SelectionEvent" this is created by Default.

public void employeeTableSelectionListener(SelectionEvent selectionEvent) {
    //#{bindings.EmployeesView1.collectionModel.makeCurrent}
    System.out.println("We are in the employeeTableSelectionListener");
    JSFUtils.resolveMethodExpression("#{bindings.EmployeesView1.collectionModel.makeCurrent}",
                                     Object.class,
                                     new Class[] { SelectionEvent.class },
                                     new Object[] { selectionEvent });
}

Just remember please, after you have finished debugging the application, you should take the println out.

#bearMan.

No comments:

Post a Comment