Question in cooperation with af:iterator and by program (add and delete records using the list)

In our application, we try to add and delete records within a one: iterator lie to the backing bean list table.

According to the feature remove should not fire any validation form so we are settign Remove button including the immediate property. And add can throw validation before adding a new record.

Here the problem comes with button Delete with activated immeidate.  The deletions list action recording is removed from the collection list at the beacking bean, but after that the interface iterator partial page refresh user displays with bad Recordset. Some how instead of getting the last recordings of server of the user interface displays the previous local values for input components.

For example: if I have 5 files in the list and delete record 2nd of collection. Backing bean (server side) the 2nd record is perfectly removal of list collection.

On the user interface, the iterator 4 records are displayed as the size of the list is 4, but instead of 2nd record the last record is not rendered. According to my understanding, as deleting comme la suppression touche key is set immediately then the some how these recordings (genereted the Id of component runtime inside the i1: 0:it1 etc...) Apply request vandekerckhove is not updated gettign, Hene showing the old local values inplace of these components of entry and this behavior is only for input components.

Can you suggest me a solution more come to the question above. Delete with immediate should unregister correspondent and only the record deleted if pannals UI.

JSFF code

<af:panelGroupLayout id="pgl1" binding="#{viewScope.formBB.mainPGL}">
        <af:iterator id="i1" value="#{viewScope.formBB.allEmployees}"
                     var="emp" rows="0" varStatus="vs"
                     binding="#{viewScope.formBB.iteratorBinding}">
          <af:panelFormLayout id="pfl1" maxColumns="4" rows="1" labelAlignment="top">
            <!--<af:outputText value="#{vs.index}" id="ot1"/>-->
            <af:inputText label="First Name" id="it1" value="#{emp.firstName}"
                          autoSubmit="true" required="true"/>
            <af:inputText label="Last Name" id="inputText1"
                          value="#{emp.lastName}" autoSubmit="true"
                          required="true"/>
            <af:commandImageLink text="Delete" id="cil1"
                                 immediate="true"
                                 actionListener="#{viewScope.formBB.deleteEmployee}">
              <f:attribute name="index" value="#{vs.index}"/>
            </af:commandImageLink>
          </af:panelFormLayout>
        </af:iterator>
        <af:commandButton text="Add New Employee" id="cb1"
                          actionListener="#{viewScope.formBB.addNewEmployee}"/>
        <af:spacer width="10" height="10" id="s1"/>
</af:panelGroupLayout>

Delete the Action listener for the bean

private List <Employee> allEmployees;
public List getAllEmployees() {
        return allEmployees;
    }
    
public void deleteEmployee(ActionEvent actionEvent) {
        int index = (Integer) actionEvent.getComponent().getAttributes().get("index");
        if(allEmployees != null && allEmployees.get(index) != null) {
            System.out.println("Emploeye Name:" + allEmployees.get(index).getFirstName());
            allEmployees.remove(index);
        }
        //AdfFacesContext.getCurrentInstance().addPartialTarget(mainPGL);
        AdfFacesContext.getCurrentInstance().addPartialTarget(iteratorBinding);
            
    }
public void addNewEmployee(ActionEvent actionEvent) {       
        Employee addE = new Employee();
        if(allEmployees != null) {
            allEmployees.add(addE);
        }
        else {
            allEmployees = new ArrayList <Employee>();
            allEmployees.add(addE);
        }
        AdfFacesContext.getCurrentInstance().addPartialTarget(mainPGL);     
    }

Jdev version - Build JDEVADF_11.1.1.7.0_GENERIC_130226.1400.6493

POC Application - https://drive.google.com/file/d/0BysBrGAsXoo0Qjh3VGkzZkRGck0/view?usp=downalod

Help, please.

You probably need to reset submitted values.

For this, you can use this util class: ResetUtils (reference Java APIs for Oracle ADF Faces)

For example: ResetUtils.reset (iteratorBinding);

BTW, you should never bind components to bean managed with a scope greater than the scope of the request.

Dario

Tags: Java

Similar Questions

Maybe you are looking for

  • LOST MY CENTER OF THEME

    My lenovo k3 got note built-in theme Center accidentally uninstalled by the system. Can someone help me how to get it back.

  • Tried to change the Bootcamp Partition, now I can't load Windows.

    Hello After trying to change my Bootcamp partition, I'm more able to start Windows. If I restart and hold option, I get only the Mac drive. However, I can still find the content of my Windows disk in the finder. Please can someone explain how I can g

  • How can I remove a file for LabVIEW does not keep a copy in memory?

    After I use the command "Delete" files Advanced features, and then create a new file with the same name, LabVIEW must have the original in memory because the file continues to grow and is not what I want to do.  I tried the deallocation "request" for

  • Pavilion dv4: simplepass identity protection

    I've upgraded from Vista to windows 7, and now the SimplePass identity protection (previously, DigitalPersona Personal 4.0) will not work.  The software loaded, but it says the fingerprint detector is not installed and asks me to install it.  I can't

  • By Magentic screen saver will not work! Any help out there?

    I am running Windows Vista on a Dell Studio nineI've got everything I can think of including related: put in startup, uninstall/reinstall, which makes my choice by default, even turning off security on downloads & installs.  But Vista refuses to laun