1 Reply Latest reply on Jul 18, 2013 5:43 PM by BAO.SZ Branched from an earlier discussion.

    Why the page cannot refresh correctly in a back bean?

    BAO.SZ

      A similar and related issue case is:

      In another page (this page have a button to launch the previous page), there is a new adf read-only table which is created from a data control based on a VO, This VO is based on the same EO with the previous one, but with a ViewCriteria of Status=-1 to filter table rows.

       

      The page code like this:

      <af:commandLink text="Unselect" id="cl1"

                                                          actionListener="#{newReceiptBean.unSelectBillPending}"

                                                          immediate="true"

      partialSubmit="true"/>

       

      The back bean code like this:

          public void unSelectBillPending(ActionEvent actionEvent) {

              // Add event code here...

              BindingContext bindingctx=BindingContext.getCurrent();            

              BindingContainer binding=bindingctx.getCurrentBindingsEntry();  

              DCBindingContainer bindingsImpl = (DCBindingContainer) binding;  

              DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("BillVO4Receipt2Iterator");

                             

              ViewObject vo=dciter.getViewObject();  

              Row rr=null;                  

              long rowc = vo.getEstimatedRowCount();

              if (rowc ==0){

                  rr=vo.first();  

              }

              else{

                  rr=vo.getCurrentRow();

              }

             

              if (rr.getAttribute("Status").equals(-1)){

                  rr.setAttribute("Status", 0);

                  rr.setAttribute("IsValid", 0);

                  rr.setAttribute("sel", false);

              }

              //actionEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());

              BindingContainer bindings = getBindings();

              OperationBinding operationBinding =bindings.getOperationBinding("Commit");

              operationBinding.execute();

              if (!operationBinding.getErrors().isEmpty()){

                  System.out.println(" operationBinding.execute(): "+operationBinding.getErrors());

              }      

                    

              BindingContainer bindings2 = getBindings();

              OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams1");

              Object result = operationBinding.execute();

              if (!operationBinding.getErrors().isEmpty()) {

                   return ;

              }

             

              AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();

              adfFacesContext.addPartialTarget(transAccountBill4NewReceiptPending);

              return ;

           }

       

      The issue for this case is:

      When the "Unselect" commandLink is pressed, changes in the row will be refreshed(Status =0, IsValid=0),

      since this adf table is based on a VO for Status=-1, and have do "ExecuteWithParams1", so this row should be cleared from the table.

      but no matter how many times I click the "Unselect" commandLink, this row still be there.

       

      Only after I put a new button as following, the above row (Status=0) will be cleared from the table.

      <af:commandButton text="  refresh  " disabled="#{!bindings.ExecuteWithParams.enabled}"

                                                            id="cb3" partialSubmit="true"

                                                            actionListener="#{newReceiptBean.refreshBillPending}"/>

       

      I do need your helps!

      Thank you in advance!