5 Replies Latest reply on May 15, 2008 10:00 AM by dxxvi

    rich:dataTable very sensitive to ajax request?

      That means when an ajax request is sent, the rich:dataTable data is reloaded (the sql statements executed tell me so). I have 2 situations to notice that.

      The 1st is:

      <a4j:form>
       <h:outputText value="Change skin to:"/>
       <rich:spacer width="20"/>
       <h:commandLink value="DeepMarine">
       <a4j:actionparam name="skin" value="deepMarine" assignTo="#{skinBean.skin}"/>
       </h:commandLink>
       <rich:spacer width="20"/>
       <h:commandLink value="BlueSky">
       <a4j:actionparam name="skin" value="blueSky" assignTo="#{skinBean.skin}"/>
       </h:commandLink>
       <rich:spacer width="20"/>
      </a4j:form>
      <rich:dataTable ... />
      It doesn't matter if a4j:form or h:form is used. Anytime I change the skin, the rich:dataTable content is reloaded.

      The 2nd situation is:
      <a4j:form>
       <a4j:commandButton ... />
       <a4j:commandButton immediate="true"/>
       <rich:dataTable ... />

      The 2 command buttons don't specify the rich:dataTable id in their reRendered attributes, but the rich:dataTable is reloaded when any button is clicked.

      I don't want the rich:dataTable to be re-loaded if I don't specify its id in the reRendered attribute. How can I do that?

        • 1. Re: rich:dataTable very sensitive to ajax request?
          moldovan

          hy dxxvi!

          the first purpose is clear:
          You are not sending an ajax request, you are performing a full page refresh with the <h:commandLink>'s. Use ajaxSubmit="true" in your a4j:form if you want to perform an ajax-request with normal h:commandLink.

          • 2. Re: rich:dataTable very sensitive to ajax request?
            ilya_shaikovsky

            and about the second:

            you should wrap the controls with the a4j:region and renderRegionOnly=true specified. Without this - all the view will be encoded(in order to have possibility to update something outside the region ;) ). But in this case you can't update nothing outside this region.

            • 3. Re: rich:dataTable very sensitive to ajax request?
              ilya_shaikovsky

              sorry.. I've take you wrong advice. All should be ok in second case if you not specified the component in reRender but http://jira.jboss.com/jira/browse/RF-3341

              • 4. Re: rich:dataTable very sensitive to ajax request?
                ilya_shaikovsky

                but the first works as it should as moldovan told you

                • 5. Re: rich:dataTable very sensitive to ajax request?

                   

                  "moldovan" wrote:
                  You are not sending an ajax request, you are performing a full page refresh with the <h:commandLink>'s. Use ajaxSubmit="true" in your a4j:form if you want to perform an ajax-request with normal h:commandLink.


                  Thanks, Moldovan. You broadened my knowledge. I gave it a couple of tries and noticed that <h:commandLink ...><<a4j:actionparam name="skin" value="deepMarine" assignTo="#{skinBean.skin}"/></h:commandLink> in a h:form or an a4j:form without ajaxSubmit="true" is the only way to change the skin. Is there any other way to change the skin with an ajax request?

                  "ilya_shaikovsky" wrote:
                  and about the second:

                  you should wrap the controls with the a4j:region and renderRegionOnly=true specified. Without this - all the view will be encoded(in order to have possibility to update something outside the region ;) ). But in this case you can't update nothing outside this region.


                  Thanks, Ilya. What I am trying to do is something like a CRUD application. The upper part of the JSF page allows us to add a new row to the database table. The lower part is a rich:dataTable having all the data in the database table. If I use a4j:region, no way to refresh the rich:dataTable after a successful new row addition. Anyway to implement a CRUD app like the one I'm trying to do?