6 Replies Latest reply on Apr 24, 2008 4:00 PM by eklam

    Questions with RichFaces3.2

    leandro godoy Apprentice

      Ola personnel, working with redhatDeveloperStudio and am having trouble adapting a table
      For the same work with the filterBy = "" and filterEvent = "onkeyup" if someone can help me mto am grateful because ja researched and posted in various forums here in the world and not got success ainda.segue below my problem.

      
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
      <html>
       <head>
       <title></title>
      <link rel="stylesheet" type="text/css"href='<%= request.getContextPath() + "/css/tabelas.css" %>'>
       </head>
       <body>
       <f:view>
       <h:form>
       <c:import url="/topo.jsp"></c:import>
       <center>
       <rich:datascroller align="center" for="tbusuario" maxPages="20" style=" width : 900px;" />
      
       <rich:dataTable
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       cellpadding="0" cellspacing="0" rows="5"
       width="700" border="0" var="user" value="#{usuario.model}" id="tbusuario" style=" width : 736px;">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column rowspan="2">
       <h:outputText value="#{msg.acoes}"></h:outputText>
       <rich:separator height="12" styleClass="tooltip"></rich:separator>
       <h:commandLink action="#{usuario.novo}" immediate="true" id="novo">
       <h:graphicImage value="/images/BOTOES/novo1.png" width="20" height="20">
       </h:graphicImage></h:commandLink>
       <rich:spacer width="13"></rich:spacer>
       <h:commandLink action="#{usuario.getTodos}" immediate="true" id="atualizar">
       <h:graphicImage value="/images/BOTOES/Restart.png" width="20" height="20">
       </h:graphicImage>
       </h:commandLink>
       </rich:column>
       <rich:column colspan="5">
       <h:outputText value="#{msg.usuario}" ></h:outputText>
       </rich:column>
       <rich:column breakBefore="true" >
      
       <h:outputText value="#{msg.codigo}" />
      
       </rich:column>
      
       <rich:column filterBy="#{usuario.nome}" filterEvent="onkeyup">
      
       <h:outputText value="#{msg.nome}" />
      
       </rich:column>
      
       <rich:column>
      
       <h:outputText value="#{msg.sobrenome}" />
      
       </rich:column>
      
       <rich:column>
      
       <h:outputText value="#{msg.setor}" />
      
       </rich:column>
      
       <rich:column>
      
       <h:outputText value="#{msg.login}" />
      
       </rich:column>
      
      
      
       </rich:columnGroup>
      
       </f:facet>
       <rich:column>
       <center>
       <h:commandLink action="#{usuario.novo}">
      
       </h:commandLink>
      
       <h:commandLink action="#{usuario.editar}" id="editar">
       <h:graphicImage value="/images/BOTOES/edit.png" width="20" height="20">
       </h:graphicImage>
       </h:commandLink>
       <rich:spacer width="13"/>
      
       <h:commandLink action="#{usuario.excluir}" id="excluir">
       <h:graphicImage value="/images/BOTOES/Trash2.png" width="20" height="20" >
       </h:graphicImage>
       </h:commandLink>
       </center>
       </rich:column>
      
      
      
      
      
       <rich:column >
       <h:outputText value="#{user.usuarioid}"></h:outputText>
       </rich:column>
       <rich:column >
       <h:outputText value="#{user.nome}"></h:outputText>
       </rich:column>
       <rich:column >
       <h:outputText value="#{user.sobrenome}"></h:outputText>
       </rich:column>
      
       <rich:column >
       <h:outputText value="#{user.setor}"></h:outputText>
       </rich:column>
      
       <rich:column >
       <h:outputText value="#{user.login}"></h:outputText>
       </rich:column>
      
      
       </rich:dataTable>
       </center>
       <div id="novo">
       <rich:toolTip for="novo"followMouse="true" direction="top-right"
       showDelay="500" styleClass="tooltip">
       <h:outputText value="#{msg.novo}"></h:outputText>
       </rich:toolTip>
       </div>
      
       <div id="atualizar">
       <rich:toolTip for="atualizar"followMouse="true" direction="top-right"
       showDelay="500" styleClass="tooltip">
       <h:outputText value="#{msg.atualizar}"></h:outputText>
       </rich:toolTip>
       </div>
      
      
      
       <c:import url="/Statusbar.jsp"></c:import>
       </h:form>
      
      
       </f:view>
       </body>
      </html>
      
      


        • 1. Re: Questions with RichFaces3.2
          leandro godoy Apprentice

          Please help me, only I would know how to run the filterby and sortBy in columns from my table.
          Sorry, my English still in beginner.
          Hugs

          • 2. Re: Questions with RichFaces3.2
            Ilya Shaikovsky Master

            At first please look through demosite example carefully.

            Main error in your code:
            you should not put this attributes to header columns. Put it to columns you need to be filtered.

            columns placed in header facet has no idea about the data column which should be filtered

            • 3. Re: Questions with RichFaces3.2
              leandro godoy Apprentice

              Ilya Shaikovsky ok, thank you for still more hint yet not worked, put the filterby only in the column of data, but not shown the input of entry, search, and when I edit the table when it plays the last of the model given in my form edition of?
              Is there something more I can do to eliminate this problem?
              Thanks.


              
              <rich:datascroller align="center" for="tbperfil" maxPages="20" style=" width : 900px;" />
              
               <rich:dataTable
               onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
               onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
               cellpadding="0" cellspacing="0" rows="5"
               width="700" border="0" var="per" value="#{perfil.model}" id="tbperfil" style=" width : 736px;">
               <f:facet name="header">
               <rich:columnGroup>
               <rich:column rowspan="2">
               <h:outputText value="#{msg.acoes}"></h:outputText>
               <rich:separator height="12" styleClass="tooltip"></rich:separator>
               <h:commandLink action="#{perfil.novo}" immediate="true" id="novo">
               <h:graphicImage value="/images/BOTOES/novo1.png" width="20" height="20">
               </h:graphicImage></h:commandLink>
               <rich:spacer width="13"></rich:spacer>
               <h:commandLink action="#{perfil.getTodos}" immediate="true" id="atualizar">
               <h:graphicImage value="/images/BOTOES/Restart.png" width="20" height="20">
               </h:graphicImage>
               </h:commandLink>
               </rich:column>
               <rich:column colspan="4">
               <h:outputText value="#{msg.perfil}" ></h:outputText>
               </rich:column>
               <rich:column breakBefore="true" >
              
               <h:outputText value="#{msg.codigo}" />
              
               </rich:column>
              
               <rich:column>
              
               <h:outputText value="#{msg.master}" />
              
               </rich:column>
              
               <rich:column>
              
               <h:outputText value="#{msg.movimentacoes}" />
              
               </rich:column>
              
               <rich:column>
              
               <h:outputText value="#{msg.cadastra}" />
              
               </rich:column>
              
              
              
               </rich:columnGroup>
              
               </f:facet>
               <rich:column>
               <center>
               <h:commandLink action="#{perfil.novo}">
              
               </h:commandLink>
              
               <h:commandLink action="#{perfil.editar}" id="editar">
               <h:graphicImage value="/images/BOTOES/edit.png" width="20" height="20">
               </h:graphicImage>
               </h:commandLink>
               <rich:spacer width="13"/>
              
               <h:commandLink action="#{perfil.excluir}" id="excluir">
               <h:graphicImage value="/images/BOTOES/Trash2.png" width="20" height="20" >
               </h:graphicImage>
               </h:commandLink>
               </center>
               </rich:column>
              
              
              
              
              
               <rich:column filterBy="#{per.perfilid}" filterEvent="onkeyup" breakBefore="false">
               <center>
               <h:outputText value="#{per.perfilid}"></h:outputText>
               </center>
              
               </rich:column>
               <rich:column >
               <center>
               <h:selectBooleanCheckbox value="#{per.pmaster}" readonly="true" disabled="true"></h:selectBooleanCheckbox>
               </center>
               </rich:column>
               <rich:column >
               <center>
               <h:selectBooleanCheckbox value="#{per.pmov}" readonly="true" disabled="true"></h:selectBooleanCheckbox>
               </center>
               </rich:column>
              
               <rich:column >
               <center>
               <h:selectBooleanCheckbox value="#{per.pcad}" readonly="true" disabled="true"></h:selectBooleanCheckbox>
               </center>
               </rich:column>
              
              
               </rich:dataTable>
              


              • 4. Re: Questions with RichFaces3.2
                Ilya Shaikovsky Master

                sorry. forgot one more suggestion.. We have an issue that headers with filtering inputs doesn't created automatically. Till it be fixed you should created header facet yourself and put for example empty outputText there

                • 5. Re: Questions with RichFaces3.2
                  leandro godoy Apprentice

                  Ok ilya_shaikovsky, really what was missing and put a facet
                  An empty outputText so that the component of search function, but nevertheless now that I caused a new problem, because qdo select an item on my table and try to edit it, my form Edit always get the last item in this DataModel , and not the item I selected in the table to Editing , what can that be?
                  Thank you very patient and the provision of help
                  Hugging.

                  • 6. Re: Questions with RichFaces3.2
                    eklam Newbie

                    Hi, your last problem is a known issue:

                    http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142194#4142194
                    http://jira.jboss.com/jira/browse/RF-3012

                    I got the same problem, but found a workround for it...

                    I have an id, that identificates my object, (you also have the msg.codigo) so the workaround is somethig like this:

                    In your commandLink

                    <h:commandLink action="#{usuario.novo}" immediate="true" id="novo">
                     <f:param name="codigoSelecionado" value="#{msg.codigo}"/>
                    <h:graphicImage value="/images/BOTOES/novo1.png" width="20" height="20">
                    </h:graphicImage></h:commandLink>


                    In the backing bean, in your method "novo", called by teh commandLink, you can use something like this:
                    long codigoSelecionado = Long.parseLong(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("idSelecionado"));
                     List auxList = (List) getListDataModel().getWrappedData();
                     for (Object o : auxList) {
                     Msg m = (Msg) o;
                     if (rc.getId() == codigoSelecionado ) {
                     setMsgSelecionada(m);
                     return;
                     }
                     }
                     throw new Exception("Objeto não encontrado.");