How to bind ADF table on button click

From ASP.NET I'm having a hard time with basic ADF concepts.

I need to bind a table on a button click, and for some reason I don't understand (I'm leaning towards the page lifecycle, which I think is different from ASP.NET) it doesn't work.

This is my ADF code:

<af:commandButton text="#{viewcontrollerBundle.CMD_SEARCH}"
    id="cmdSearch"
    action="#{backingBeanScope.indexBean.cmdSearch_click}"
    partialSubmit="true"/>

<af:table var="row" rowBandingInterval="0" id="t1"
                    value="#{backingBeanScope.indexBean.transactionList}"
                    partialTriggers="::cmdSearch"
                    binding="#{backingBeanScope.indexBean.table}">
            <af:column sortable="false" headerText="idTransaction" id="c2">
              <af:outputText value="#{row.idTransaction}" id="ot4"/>
            </af:column>
            <af:column sortable="false" headerText="referenceCode" id="c5">
              <af:outputText value="#{row.referenceCode}" id="ot7"/>
            </af:column>
          </af:table>

      

This is cmdSearch_click:

public String cmdSearch_click() {
    List l = new ArrayList();
    Transaction t = new Transaction();
    t.setIdTransaction(BigDecimal.valueOf(1));
    t.setReferenceCode("AAA");
    l.add(t);

    t = new Transaction();
    t.setIdTransaction(BigDecimal.valueOf(2));
    t.setReferenceCode("BBB");
    l.add(t);

    setTransactionList(l);

    // AdfFacesContext.getCurrentInstance().addPartialTarget(table);

    return null;
 }

      

The commented line doesn't work either.

If I populate the list in my Bean constructor, the table looks fine.

Any ideas?

+2


a source to share


3 answers


This is an area problem.

After reading this post , I think the correct way to do it is to set it in the viewScope



If anyone thinks this is wrong, please let me know. So far, this is my answer.

+2


a source


I'm not sure if the bean support is the one you want to use. I would suggest either pageFlowScope or Session scope. They are most closely related to what you want to model.

The PageFlowScope follows what the user clicks, so two instances of the same web app / same user have different PageFlow scopes.

Session scope is shared by all instances of a web application by the same user.



The application area is common to all users. I would almost always avoid it.

The request scope only lasts between view requests. Not very useful except for extremely short data.

0


a source


You don't have to install it on sessionScope. It will remain in effect until the user session is active. You might want to use either a FlowScope page (this is really for the life of the page) or a requestScope, which is valid from the moment the client requests a request until it receives a response.

0


a source







All Articles