incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "magdolna holitska" <mholits...@hotmail.com>
Subject Table refresh problem when using dialog
Date Fri, 05 Jan 2007 17:01:27 GMT
Hello,

I have a table containing numbers and a link: "Add New".
When the user clicks on the link, a new number will be added to the table.


The problem I have is:
If I have the link outside the table, the number will be added to the list 
and the table will be refreshed properly.

At the other hand, when I place the command link inside the table, the 
number will be added to the list, but the table is not refreshed with the 
new value.

I only noticed this behaviour when I am using it with dialogs. If I just use 
an ActionEvent instead of a ReturnEvent, it works fine.

This is just a simple example that I prepared to point out the issue, but of 
course in the real application I do have values that I am passing and 
retrieving from the dialog.

I also pasted the code below.


Thank you in advance.
Regards,
Magdolna




Example.xhtml:
        <tr:commandLink id="cmdOut" text="Add New"
                        useWindow="true" windowWidth="300" 
windowHeight="400"
                        partialSubmit="true" action="dialog:numDialog"
                        returnListener="#{exampleBean.numDialogReturned}"/>
        <tr:table id="data" value="#{exampleBean.numList}" var="data"
                partialTriggers="cmdIn cmdOut" width="20%">
            <tr:column id="userAction" headerText="User Action">
                <tr:commandLink id="cmdIn" text="Add New"
                                useWindow="true" windowWidth="300" 
windowHeight="400"
                                partialSubmit="true" 
action="dialog:numDialog"
                                
returnListener="#{exampleBean.numDialogReturned}"/>
            </tr:column>
            <tr:column id="num" headerText="Number">
                 <tr:outputText value="#{data}"/>
            </tr:column>
        </tr:table>

ExampleBean.java:
    private List<Integer> numList;
    private int num = 100;

    public List<Integer> getNumList() {
        if (numList == null) {
            numList = new ArrayList();
        }
        System.out.println("numList: ("+numList.size()+"): "+numList);
        return numList;
    }
    public void numDialogReturned(ReturnEvent event) {
        System.out.println("--- RETURN");
        Boolean isAdd = (Boolean)event.getReturnValue();
        if (isAdd)
            numList.add(new Integer(num++));
    }

    // DIALOG
    public void performOK(ActionEvent e) {
        logger.debug("Click OK ");
        RequestContext.getCurrentInstance().returnFromDialog(true,null);
    }
    public void performCancel(ActionEvent e) {
        logger.debug("Click Cancel ");
        RequestContext.getCurrentInstance().returnFromDialog(false,null);
    }

NumDialog.xhtml
    <tr:form>
        <tr:panelFormLayout labelWidth="40%">
           <tr:panelButtonBar>
               <tr:commandButton text="OK" 
actionListener="#{equipmentDetailBean.performOK}"/>
               <tr:commandButton text="Cancel" immediate="true" 
actionListener="#{equipmentDetailBean.performCancel}"/>
           </tr:panelButtonBar>
        </tr:panelFormLayout>
    </tr:form>

_________________________________________________________________
Discover Live.ca, the search engine by the creators of Windows Live 
Messenger http://www.live.com/?mkt=en-ca


Mime
View raw message