5 Replies Latest reply on May 9, 2011 9:54 AM by nikh123123

    a4j:ajax inside rich:dataTable

    nikh123123

      Hi Guys,

       

      Straight question - Is it possible to show a a4j:status inside a rich:dataTable untill the data is loaded with a4j:jsFunction? Please note that i'm also using the noDataLabel attribute as well, so be default that text is shown inside it. Can anyone suggest me any approach?

        • 1. a4j:ajax inside rich:dataTable
          snaker

          Maybe if you use a jsFunction for load a table, only have to put the attribute "status" status="nameStatus"

           

          and later cretate the status

           

           

          <a4j:status name="nameStatus" onstart="#{rich:component('Loading')}.show();" onstop="#{rich:component('Loading')}.hide();" />

          • 2. a4j:ajax inside rich:dataTable
            nikh123123

            @Kike I'm Sorry for this late reply. Yes I'm aware of this method. I wanted something like

             

            1. when the grid is rendered, it should show a loading image inside.

            2. When the data is fetched, if the data is empty, show a message like "No data". If the data is not empty, show the data. By this time the image should be gone.

             

             

            Here's what I did

            1. assigned a loading image as a background for the class rf-dt-nd

            2. called the a4j:jsFunction on dom ready of page

            3. on completion of a4j:jsFunction, if there's no data, replaced the text inside rf-dt-nd-c classes with "No data" and removed the background image. Both with jQuery.

            4. If there's data, i didnt need to do anything as it does not render rf-dt-nd class at all

            • 3. a4j:ajax inside rich:dataTable
              snaker

              there is an example in demo richfaces about jquery

               

              something like this:

               

              <rich:jQuery selector=".table1 tr" event="mouseover" query="jQuery(this).addClass('activeRow')" />
              <rich:jQuery selector=".table1 tr" event="mouseout" query="jQuery(this).removeClass('activeRow')"/>

               

               

              .activeRow{
              background-color: lightyellow;/*Moccasin*/
              cursor: pointer;
              }

               

              Do you need something like this??

              • 4. a4j:ajax inside rich:dataTable
                ilya_shaikovsky

                Here's what I did

                1. assigned a loading image as a background for the class rf-dt-nd

                2. called the a4j:jsFunction on dom ready of page

                3. on completion of a4j:jsFunction, if there's no data, replaced the text inside rf-dt-nd-c classes with "No data" and removed the background image. Both with jQuery.

                4. If there's data, i didnt need to do anything as it does not render rf-dt-nd class at all

                that sounds like valid approach actually. So on which state you having a problem?

                • 5. a4j:ajax inside rich:dataTable
                  nikh123123

                  @Ilya and @Kike,

                  Sorry I should have made it clear in my last reply itself - the approach which I took does work , but I just wanted to share it here

                  And now that its been confirmed by @Ilya, I'm glad to know that I'm on the right track! Thanks both!

                   

                  PS: In case anyone trying this later on, need to remember that noDataLabel needs to be kept " " i.e. a space. Otherwise the rf-dt-nd class and its subclasses will never get rendered.