2 Replies Latest reply: Jul 23, 2010 8:26 AM by 776716 RSS

    closing the af:popuo programmatically does not refresh the caller

      Hi All,

      I am using jdeveloper 11g and adf business components.
      I have a simple page which displays a database table (a view object). On this table, i have to perform insert, update, delete operations.
      i refered the following link and managed to create the entire process.

      For the update functinality i have implemented an af popup element which opens the current record as a popup window and it works fine.
      I have to add validation while updating, hence on the submit button of the popup i added my validation code and to show the message i added partialsubmit = true on the submit button.
      Now it shows the validations but even after it is validated it stays on the pop up, does not close the window.
      To close the window , i added closing popup code in my bean.
            StringBuilder script = new StringBuilder();
            FacesContext context =  FacesContext.getCurrentInstance();
                 script.append("var popup = AdfPage.PAGE.findComponent('").append("p1").append("'); ")            
                     .append("if (popup.isPopupVisible()) { ").append("popup.hide();}");
                 ExtendedRenderKitService erks =
                             Service.getService(context.getRenderKit(), ExtendedRenderKitService.class);
                 erks.addScript(context, script.toString());
      After this the pop up gets closed but does not show the updated row(though it is upadted in the db), that is the caller table is not refreshed.
      The work around is that i add one more button soemthing like "save" which does not have any action listerner and just closes the pop up and refreshes the page.
      BUt i dont want user to have 2 buttons for one operation hence would like to know if there is a any other way to achieve it.
      Besides this, lets say i make some changes on the popup form but click on cancel, the table reflects the changes(no changes are made in the db)
       <af:commandButton text="Cancel" id="cb8"/>
      To solve this problem, i added actionlisterner on the cancel button which programmatically closes the popup window , so that the table is not refreshed with changed values.
      But if i click the same link again which populates the popup, the inputtext components shows the value that was altered before clicking cancel.
      I dont know how should i solve this thing, i am sure i am missing on something.
      any help is highly appreciated.