2 Replies Latest reply on Nov 23, 2007 10:43 AM by Artyom Vorobyev

    Problems with a4j:commandLink, rich:datascroller and rich:da

    Artyom Vorobyev Newbie

      Hi!
      I have the following problem - in the cells of my dataTable I have command links thats are used to change the form content on the same page below (it is the form to edit values in the dataTable cells). But when I click this command links everything works fine but the data scrolling. Pages after clicking on the command links can be changed suddenly. I click the link and after that the page can be jumped from first to second, or from third to first etc.
      Could you please help me?

      Thanks in advance!

      Best wishes, Artyom!

        • 1. Re: Problems with a4j:commandLink, rich:datascroller and ric
          Ilya Shaikovsky Master

          need code snippets and environment info.

          • 2. Re: Problems with a4j:commandLink, rich:datascroller and ric
            Artyom Vorobyev Newbie

            Hi! Thanks for the answer. The code is:

            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
            
            <f:view>
            <rich:panel id="usersList">
             <f:facet name="header">
             <h:outputText value="Users" id="usersListHeaderTextId"/>
             </f:facet>
             <a4j:form id="usersListForm">
             <rich:dataTable id="usersListDataTable" rows="10" columnClasses="col"
             value="#{newUserForm.users}" var="user" width="100%">
             <f:facet name="header">
             <rich:columnGroup id="usersListDataTableColumnsHeaders">
             <h:column id="usersListDataTableColumnsHeader1">
             <h:outputText styleClass="headerText" value="User name" id="usersListDataTableColumnsHeaderText1"/>
             </h:column>
             <h:column id="usersListDataTableColumnsHeader2">
             <h:outputText styleClass="headerText" value="EMail" id="usersListDataTableColumnsHeaderText2"/>
             </h:column>
             <h:column id="usersListDataTableColumnsHeader3">
             <h:outputText styleClass="headerText" value="Login" id="usersListDataTableColumnsHeaderText3"/>
             </h:column>
             </rich:columnGroup>
             </f:facet>
            
             <h:column id="usersListDataTableColumnsContent1">
             <h:outputText value="#{user.login}" id="usersListDataTableColumnsContentValue1"/>
             </h:column>
             <h:column id="usersListDataTableColumnsContent2">
             <h:outputText value="#{user.email}" id="usersListDataTableColumnsContentValue2"/>
             </h:column>
             <h:column id="usersListDataTableColumnsContent3">
             <a4j:htmlCommandLink action="#{newUserForm.fillUserEditForm}" id="usersListDataTableColumnsContentCommandLink3">
             <h:outputText value="Edit" id="usersListDataTableColumnsContentValue3"/>
             <a4j:actionparam name="userId" value="#{user.id}" id="usersListDataTableColumnsContentUserIdParam"/>
             <%--<a4j:support event="oncomplete" reRender="editUserForm" id="usersListDataTableColumnsContentOnComplete"/>--%>
             <a4j:support event="oncomplete" id="usersListDataTableColumnsContentOnComplete"/>
             </a4j:htmlCommandLink>
             </h:column>
            
             <f:facet name="footer">
             <rich:datascroller id="usersDataScroller" for="usersListDataTable"/>
             </f:facet>
             </rich:dataTable>
             </a4j:form>
            </rich:panel>
            
            <h:form id="newUserForm">
             <h:panelGrid columns="3" id="newUserFormGrid">
             <h:outputLabel value="Name:"/>
             <h:inputText value="#{newUserForm.name}" required="true" id="name">
             </h:inputText>
             <rich:message id="nameUserValidMessage" for="name">
             <f:facet name="errorMarker">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
             <h:outputLabel value="Username:"/>
             <h:inputText value="#{newUserForm.userName}" required="true" id="userName">
             </h:inputText>
             <rich:message id="nameUserValidMessage2" for="userName">
             <f:facet name="errorMarker2">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
            
             <h:outputLabel value="Password:"/>
             <h:inputText binding="#{newUserForm.passwordField}" value="#{newUserForm.password}" required="true"
             id="password">
             </h:inputText>
             <h:inputHidden/>
            
             <h:outputLabel value="Confirm password:"/>
             <h:inputText binding="#{newUserForm.passwordConfirmationField}" value="#{newUserForm.passwordConfirmation}"
             validator="#{newUserForm.zlobnyiValidator}" required="true" id="passwordConfirmation">
             </h:inputText>
             <rich:message id="userPasswordValidMessage" for="passwordConfirmation">
             <f:facet name="errorMarker">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
            
             <h:outputLabel value="Email:"/>
             <h:inputText value="#{newUserForm.EMail}" required="true" id="Email">
             </h:inputText>
             <rich:message id="emailValidMessage" for="Email">
             <f:facet name="errorMarker3">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
            
             <h:outputLabel value="Group"/>
             <h:selectOneMenu id="groups"
             value="#{newUserForm.groupId}" style="width:150px;">
             <f:selectItems value="#{newUserForm.groupsForNewUser}"/>
             </h:selectOneMenu>
             <h:inputHidden/>
             <h:inputHidden/>
             <a4j:commandButton value="Add user" id="addUserButtonId"
             action="#{newUserForm.addUser}"
             reRender="users, usersList">
             </a4j:commandButton>
             <h:inputHidden/>
             </h:panelGrid>
            </h:form>
            
            <h:form id="editUserForm">
             <h:panelGrid columns="3">
             <h:outputLabel value="Name:"/>
             <h:inputText value="#{newUserForm.editUserName}" required="true" id="editUserName">
             </h:inputText>
             <rich:message id="editUserNameValidMessage" for="editUserName">
             <f:facet name="errorMarker">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
             <h:outputText value="#{newUserForm.editUserId}" id="editUserId"/>
             <h:outputLabel value="Username:"/>
             <h:inputText value="#{newUserForm.editUserUserName}" required="true" id="editUserUserName">
             </h:inputText>
             <rich:message id="editUserNameValidMessage2" for="userName">
             <f:facet name="errorMarker2">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
            
             <h:outputLabel value="Password:"/>
             <h:inputText value="#{newUserForm.editUserPassword}" required="true"
             id="editUserPassword">
             </h:inputText>
             <h:inputHidden/>
            
             <h:outputLabel value="Confirm password:"/>
             <h:inputText value="#{newUserForm.editUserPasswordConfirmation}"
             required="true" id="editUserPasswordConfirmation">
             </h:inputText>
             <rich:message id="versionTitleValidMessage" for="passwordConfirmation">
             <f:facet name="errorMarker">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
            
             <h:outputLabel value="Email:"/>
             <h:inputText value="#{newUserForm.editUserEMail}" required="true" id="editUserEmail">
             </h:inputText>
             <rich:message id="emailValidMessage" for="Email">
             <f:facet name="errorMarker3">
             <h:graphicImage url="../images/ajax/error.gif"/>
             <h:outputText value="error"/>
             </f:facet>
             </rich:message>
             <a4j:commandButton value="Save user" id="editUserQwerty"
             action="#{newUserForm.saveUser}"
             reRender="usersList">
             </a4j:commandButton>
             <h:inputHidden/>
             </h:panelGrid>
            </h:form>
            </f:view>



            Environment: JSF 1.1 from Sun, Tomcat 5.5.xx.

            Best wishes, Artyom.