This content has been marked as final.
Show 2 replies
-
1. Re: Action On RowClick
triantafyllos May 4, 2008 6:32 PM (in response to leesy)Hi,
I am not sure if this is the best solution, but I tried it and it works fine for me!
In the XHTML code:<rich:dataTable id="tourstationen" value="#{backingbean.list}" var="place" rows="5" rowKeyVar="rkv" > <a4j:support event="onRowClick" actionListener="#{backingbean.selectionChanged}" />
In the Backing bean I implemented following method:
public void selectionChanged(ActionEvent event) { UIComponent comp = event.getComponent(); Object obj = comp.getParent(); if (obj instanceof HtmlDataTable) { HtmlDataTable table = (HtmlDataTable) obj; Object rowData = table.getRowData(); if (rowData instanceof MyObject) { MyObject selObj = (MyObject) rowData; setSelectedObject(selObj ); } } }
Cheers,
trian
-
2. Re: Action On RowClick
edlin Sep 18, 2008 5:08 PM (in response to leesy)I had a similar issue perhaps, I thought having a onRowClick in my rich:dataTable was blocking the a4j:support event.
It was, but the answer was to include a return true; at the end of my javascript function.So, make sure your toggleSelectedRow(this) is returning true.
Also you can take the javascript out of the rich:dataTable and move it to the a4j:support.
<a4j:support event="onRowClick" onsubmit="toggleSelectedRow(this)" actionListener="#{someBean.onSelectionChange}"/>
I tried on oncomplete, but then it only highlights the cell (the TD).