8 Replies Latest reply on Feb 4, 2008 4:58 PM by viggo.navarsete

    hoe can i do...

    pdaniel

      I am trying to do a search using richfaces in a portal environment. I've made the search to work but i have a problem with the table that is populated with search results. The table is shown in the same page as the input forms. My problem is that i cannot hide the table header until the search returns any data. I don't want to use javascript to show/hide the table. I want to know if there is a solution directly using the richfaces. I've put rendered="false" to the table, but now when i click my search button the flag on the table remain false, although i've put reRender="" on my commandButton. This table is included in the page with <a4j:include....>. Can i tell somehow to my commandButton that when it is pressed to change the rerender attribute from my dataDable to true?

        • 1. Re: hoe can i do...
          mmichalek

          I think that your reRender needs to point at some component that was already rendered for it to work. So, you could put the table in something like a subview or panelGroup which is always rendered, and reRender that on the ajax call.

          • 2. Re: hoe can i do...
            pdaniel

            If i do this then the table header will stay always on the screen even if i didn't press the search button. I need a way to hide the table header until the search button is pressed.

            • 3. Re: hoe can i do...
              pdaniel

              portions of my files :

              my command button, above i have the search fields:


              <a4j:commandButton action="#{controller.executeSearch}" value="Search" reRender="documentSearchResults" />


              outside the form i have :


              <a4j:include viewId="/portlets/myportlet/jsf/include/search_table.jspx" />


              the search_table file :


              <jsp:root
              xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns="http://www.w3.org/1999/xhtml" version="2.0">
              <f:subview id="searchtable"
              xmlns:p="http://java.sun.com/jsf/portlet/components"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:a4j="http://richfaces.org/a4j"
              xmlns:rich="http://richfaces.org/rich">

              <h:panelGroup id="documentSearchResults">
              <rich:dataTable var="docsearch" id="doclist" value="#{not empty bean.listBean}" cellpadding="2" cellspacing="2" width="100%">


              • 4. Re: hoe can i do...
                mmichalek

                I'm not sure if this is your exact code, but according to what was posted here, your dataTable needs attention:

                Your value attribute should be value="#{bean.listBean}" and you need to add a rendered attribute to the dataTable (rendered="#{not empty bean.listBean}")

                So that would give you:

                <rich:dataTable var="docsearch" id="doclist" value="#{bean.listBean}" rendered="#{not empty bean.listBean}" cellpadding="2" cellspacing="2" width="100%">
                


                • 5. Re: hoe can i do...
                  pdaniel

                  Thx alot, i've added not empty the value instead of added it to the rerendered attribute. But i still have a problem. Wen i press first time the search button my table header appears without the style sheet. When i press second time on the button the css is applied. I have this problem only in IE. Do you have any clue?

                  • 6. Re: hoe can i do...
                    mmichalek

                    I don't have ideas for that one. Some things I would check: Do the default RichFaces styles apply to the table? Does it help if you specify a styleClass on the table? What happens if you manually refresh the page after the first button click?

                    I would also mess around with the org.richfaces.LoadStyleStrategy and org.ajax4jsf.COMPRESS_STYLE web.xml parameters and check if that makes any difference. You can also try changing the enable-cache paramter on the ajax4jsf filter. (Other posts and documentation give more specifics on these parameters)

                    These are just some things I would check - I really have no idea what's causing your problem.

                    • 7. Re: hoe can i do...
                      pdaniel

                      Ok, thx for the help.

                      • 8. Re: hoe can i do...
                        viggo.navarsete

                        any updates? Were you able to make it work pdaniel?