RichFaces DataTable and the mystery of the out of synch row
nmatrix9 Sep 2, 2009 12:18 AMHello RichFaces,
I'm stuck on a slight richfaces datatable issue, You see I have datatable with a list of usernames and I also have a inputText field where upon entering a name the datatable rerenders with closest username results. Upon which I can drag and drop the user name on drop target BUT for some reason after the datatable is rerendered and I try to drag and drop the search result username, after dropping the username it's still pointing to the old "row Index? and data".
for example I do a search for "John_1" and the datatable rerenders with search result "John_1". So now when I drag that username (John_1) and drop it on the drop target the drop target is suppose to display "John_1" but instead it displays the previous first row username before search (lets call that username "username_Index0").
My assumption as to what is going on is that even though the datatable is being re-rendered with the search results, the datamodel/serverside list of the richfaces indexing mechanism is not updating itself with the clientside results. So in effect in even though I do a search on a datatable with a 1000 rows and the re-render search result displays 2 rows the serverside datamodel is still containing a 1000 rows of the old data and indexes instead of the two rows for search results.
If anyone has encountered anything similar or can point me to some documentation that will clarify what is going on I will greatly appreciate it.
<rich:simpleTogglePanel label="Users search parameters" switchType="ajax" opened="false" ignoreDupResponses="true" eventsQueue="userSearchQueue" requestDelay="2000" ajaxSingle="true" immediate="true">
<s:decorate template="/layout/display.xhtml">
<ui:define name="label">Username</ui:define>
<h:inputText id="username" value="#{exoshellUsersList.exoshellUsers.username}">
<a:support event="onblur" reRender="panelusers,userRolesPaginator" ajaxSingle="true" ignoreDupResponses="true" action="#{exoshellUsersList.updateElementValues}"/>
</h:inputText>
</s:decorate>
<s:decorate template="/layout/display.xhtml">
<ui:define name="label">Firstname</ui:define>
<h:inputText id="firstname" value="#{exoshellUsersList.exoshellUsers.firstname}">
<a:support event="onblur"/>
</h:inputText>
</s:decorate>
<s:decorate template="/layout/display.xhtml">
<ui:define name="label">Lastname</ui:define>
<h:inputText id="lastname" value="#{exoshellUsersList.exoshellUsers.lastname}">
<a:support event="onblur"/>
</h:inputText>
</s:decorate>
<s:decorate template="/layout/display.xhtml">
<ui:define name="label">Emailaddress</ui:define>
<h:inputText id="emailaddress" value="#{exoshellUsersList.exoshellUsers.emailaddress}">
<a:support event="onblur"/>
</h:inputText>
</s:decorate>
<s:decorate template="/layout/display.xhtml">
</s:decorate>
</rich:simpleTogglePanel>
<rich:panel id="panelusers">
<f:facet name="header">Users list</f:facet>
<h:outputText value="There are no Users associated with this UserRole."
rendered="#{empty exoshellUsersList.resultList}"/>
<rich:dataTable var="_exoshellUsers"
value="#{exoshellUsersList.resultList}"
rendered="#{not empty exoshellUsersList.resultList}"
rowClasses="rvgRowOne,rvgRowTwo"
id="exoshellUsersTable" rows="10">
<rich:column>
<f:facet name="header">User id</f:facet>
<h:outputText value="#{_exoshellUsers.userId}"/>
</rich:column>
<rich:column>
<f:facet name="header">Username</f:facet>
<rich:dragSupport dragIndicator=":indicator" dragType="userId" dragValue="#{_exoshellUsers}" ajaxSingle="true">
<rich:dndParam name="label" value="#{_exoshellUsers.username}"/>
</rich:dragSupport>
<h:outputText value="#{_exoshellUsers.username}" />
</rich:column>
<h:column>
<f:facet name="header">Registered</f:facet>
<h:outputText value="#{_exoshellUsers.registered}">
<s:convertDateTime type="date" dateStyle="short"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Last login</f:facet>
<h:outputText value="#{_exoshellUsers.lastLogin}">
<s:convertDateTime type="both" dateStyle="short"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Ip address</f:facet>
<h:outputText value="#{_exoshellUsers.ipAddress}"/>
</h:column>
<h:column>
<f:facet name="header">Accountenabled</f:facet>
<h:outputText value="#{_exoshellUsers.accountenabled}"/>
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<s:link view="/admin/ExoshellUsers.xhtml"
id="viewexoshellUsers"
value="View"
propagation="none">
<f:param name="exoshellUsersUserId"
value="#{_exoshellUsers.userId}"/>
<f:param name="exoshellUsersFrom"
value="ExoshellUserRolesEdit"/>
</s:link>
</h:column>
</rich:dataTable>
</rich:panel>
<rich:datascroller id="userRolesPaginator" maxPages="5"
for="exoshellUsersTable" renderIfSinglePage="false" eventsQueue="usersList" ignoreDupResponses="true" requestDelay="1000">
</rich:datascroller>