1 Reply Latest reply: Dec 10, 2012 1:28 AM by Cmoster-Oracle RSS

    Data Not Refresh when using immediate button

    Cmoster-Oracle
      Hi All,

      I am using JDev 11.1.1.6.

      The scenario is as follows.

      I have a page with 2 buttons (called previous and next ). And inside that page, I have a region *(region1)* with the page fragment which is showing data (let's assume employees data). When I click next, the region will show the next employee's data. And for previous, it will show previous employee's data. And there are fields to be filled out for each employee, and fields have validations also. For previous button, we use immediate="true" to *skip validation* because for previous button, there will be no validations.

      Whenever we pressed these buttons, we refresh the *region1* through region binding (eg., this.getMyRegion().refresh(FacesContext.getCurrentInstance())), and show the new data.

      For *next* button, it is working fine.

      The *PROBLEM* is that *when I press the previous button, the components inside the region are NOT refreshed with the new data. They are still showing the old data*. One interesting thing is that components with *readonly="true"* are showing the *correct data*.

      When I searched about that issue, some suggests that it's because components' *local value* are not cleared when using immediate button.
      I tried with <af:resetActionListener /> for the commandbutton (as below). But it's not working.

      +<af:commandButton text="Previous" id="btn1" action="#{backingBeanScope.mybean.doAction}" immediate="true">+
      +<af:resetActionListener/>+
      +</af:commandButton>+

      I also don't understand why *readonly components* are refreshed with the new data.

      Could you all please help me with this issue? If I need to clear the components' local value, how do I clear these in efficient way?

      Thanks a lot.



      Best Regards,

      cmoster
        • 1. Re: Data Not Refresh when using immediate button
          Cmoster-Oracle
          Hi,

          This issue has been fixed. I solved it by using ResetActionListener in commandButton's actionListener method as follows:

          +public void previousActionListener(ActionEvent actionEvent) {+
          ResetActionListener ral=new ResetActionListener();
          ral.processAction(actionEvent);
          +}+

          But I still don't understand why only readonly components are refreshed with the new data in my previous problem in my first post.

          Anyway, the issue is fixed now. I am just curious to know.

          Best Regards,

          cmoster