-
1. Re: Sortable dataTable returns wrong data in rowclick listener in RichFaces 4
nick.graves Oct 16, 2012 1:55 PM (in response to jifero27)Good morning.
I ran into a similar issue with the dataTable tag. I found a suggestion online that said to pass the whole object into the selection listener and not the row ID. The sorting function will not rebuild the list and will retain the original structure, so your row ID will point to the orgingal row with that ID. So, try and modify your a4j:ajax tag like so:
from-
<a:ajax
listener="#{appQuery.actionListener(row.id)}"
event="rowclick" render=":applistform:appViewId"/>to-
<a:ajax
listener="#{appQuery.actionListener(row)}"
event="rowclick" render=":applistform:appViewId"/>Modify your listener to receive an object of type ... and then obtain your row ID etc.
Let me know if that helps.
Nick G.
-
2. Re: Sortable dataTable returns wrong data in rowclick listener in RichFaces 4
jifero27 Oct 16, 2012 5:58 PM (in response to nick.graves)No. It does not change anything.
In RF 3 almost the same functionality (with a4j:support) works OK. But I didn't find in any migration guide any information about important difference between a4j:support and a4j:ajax, that may be a reason of such problem.
-
3. Re: Sortable dataTable returns wrong data in rowclick listener in RichFaces 4
nick.graves Oct 16, 2012 6:16 PM (in response to jifero27)1 of 1 people found this helpfulOkay. I reviewed some of my existing code and found that when I filter my dataTable, I was having the same issue. One suggestion I found is to remove the a4j:ajax tag and add an a4j:outputLink tag to the first column. The outputLink will be bound to each row and can be styled to "none". Here is a copy of my code:
<rich:dataTable value="#{tempController.items}" var="item" id="tempConfigTable" rows="10" style="text-align: center;">
<rich:column style="width:200px" filterValue="#{tempController.fromMemberFilter}" filterExpression="#{fn:containsIgnoreCase(item.frommember,tempController.fromMemberFilter)}">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="from member"/>
<text> </text>
<h:inputText value="#{tempController.fromMemberFilter}" label="From Member">
<a4j:ajax event="blur" render=":tempConfigTable :tempConfigTableDataScroller" execute="@this" />
</h:inputText>
</h:panelGroup>
</f:facet>
<h:outputText value="#{item.frommember}"/>
<!-- the hidden command link below will replace the "rowclick" functionality and pass the correct object to your listener -->
<a4j:commandLink value="select" action="#{tempController.selectionListener(item)}"
execute="@this" render=":detailForm:detailPanel" style="display:none !important;" styleClass="selLink"/>
</rich:column>
Listener code:
public void selectionListener(TempConfigClass itemObject) {
setSelectedTempConfig(itemObject);
}
The hidden command link may help you. I will try to find the original blog entry etc. that helped me find my solution.
Nick G.
-
4. Re: Sortable dataTable returns wrong data in rowclick listener in RichFaces 4
jifero27 Oct 17, 2012 3:34 AM (in response to nick.graves)Thank you very much, Nick. Your solution works.
The other is server side sorting - if I re-sort the source list (
appQuery.applicationList)
in managed bean, everything is working fine with a4j:ajax too.It seems however that there's a problem with a4j:ajax and f:ajax and client side sorting in dataTable. The question is: it is a bug in rich:dataTable or f:ajax?
Maybe someone can explain the reason of the behaviour?