3 Replies Latest reply on Apr 27, 2010 9:47 AM by Ilya Shaikovsky

    How to holding Entity Query search values when returning to page

    Busssard Buss Newbie

      Hello All,

       

      I created a new CRUD project using JBoss Tools. It runs very well. But one thing don't work as I expected: When returning from a xxxEdit the xxxList has its search param cleared and the list returns to the first page.

       

      I looked in many foruns but without a direct response.

       

      So this is what I have:

       

      The xxxList with a rich:dataTable and the action colum

       

      <rich:column styleClass="action">
                  <f:facet name="header">Ação</f:facet>
                  <s:link view="/MetasNivelamento/#{empty from ? 'Comarcas' : from}.xhtml"
                         value="#{empty from ? 'Lançar Dados' : 'Selecionar'}"
                   propagation="#{empty from ? 'none' : 'default'}"
                            id="comarcasViewId">
                      <f:param name="comarcasId"
                              value="#{_comarcas.id}"/>
                  </s:link>
      </rich:column>
      

       

      The xxxEdit with the follwing returning buttom

       

      <s:button view="/MetasNivelamento/#{empty comarcasFrom ? 'ComarcasList' : comarcasFrom}.xhtml"
                          id="done"
                       value="Return"/>
      

       

      And here is my extend to EntityQuery

       

       

      @SuppressWarnings("serial")
      @Name("comarcasList")
      public class ComarcasList extends EntityQuery<Comarcas> {
      
          private static final String EJBQL = "select comarcas from Comarcas comarcas";
      
          private static final String[] RESTRICTIONS = {
                  "lower(comarcas.polo) like lower(concat(#{comarcasList.comarcas.polo},'%'))",
                  "lower(comarcas.regiaoJudiciaria) like lower(concat(#{comarcasList.comarcas.regiaoJudiciaria},'%'))",
                  "lower(comarcas.entrancia) like lower(concat(#{comarcasList.comarcas.entrancia},'%'))",
                  "lower(translate(comarcas.comarca,'âàãáÁÂÀÃéêÉÊíÍóôõÓÔÕüúÜÚÇç','AAAAAAAAEEEEIIOOOOOOUUUUCC')) like lower(concat(translate(#{comarcasList.comarcas.comarca},'âàãáÁÂÀÃéêÉÊíÍóôõÓÔÕüúÜÚÇç','AAAAAAAAEEEEIIOOOOOOUUUUCC'),'%'))",
                  "lower(translate(comarcas.varaComum,'âàãáÁÂÀÃéêÉÊíÍóôõÓÔÕüúÜÚÇç','AAAAAAAAEEEEIIOOOOOOUUUUCC')) like lower(concat('%',translate(#{comarcasList.comarcas.varaComum},'âàãáÁÂÀÃéêÉÊíÍóôõÓÔÕüúÜÚÇç','AAAAAAAAEEEEIIOOOOOOUUUUCC'),'%'))",
                  "lower(comarcas.competencia) like lower(concat(#{comarcasList.comarcas.competencia},'%'))", };
      
          private Comarcas comarcas = new Comarcas();
      
          public ComarcasList() {
              setEjbql(EJBQL);
              setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
              setMaxResults(25);
          }
      
          public Comarcas getComarcas() {
              return comarcas;
          }
      }
      

       

      If I use the browser's back buttom (or a equivalent Ajax function ) it work as expected.

       

      Anybody has a solution ?