In my JSF 2 application I have a Richfaces extendedDataTable. When I doubleclick on a row I want to leave this page and I will display the details of the selected table entry on this other page. I tryied the following in the table page:
<rich:extendedDataTable
value="#{bean.loadedAnfragen}" var="anfrage"
selection="#{bean.selectedAnfrage}" id="anfragenTable"
selectionMode="single"
onrowdblclick="showAnfrage();">
... here are my columns ...
</rich:extendedDataTable>
<a4j:jsFunction name="showAnfrage" action="#{bean.showAnfrage}" />
The method in the bean gets called but the selection (the row where I double clicked) is null. This is the code for the appropriate method:
public void showAnfrage() {
UIExtendedDataTable table = ( UIExtendedDataTable )FacesContext.getCurrentInstance().getViewRoot().findComponent( "mainForm:anfragenTable" );
if( table != null ) {
for( Object selection : table.getSelection() ) {
System.out.println( "Thats the selected object: " + selection );
}
}
}
I also tried some ajax stuff. I wanted to pass the selection with f:setPropertyActionListener
inside an a4j:ajax
tag but this is impossible because the datatable itself is no action source so the setPropertyActionListener tag cannot be called.
Doeas anyone has a solution for getting the selected item after doubliclicking the extendedDataTable row?