Hi all,

Did anyone had a chance to have a look at the issue I am having below?

Here are a few more details:

In the example below I am trying to add one row to a table using PPR.
The command link that opens the dialog is inside the table, in each row.
When the dialog returns a new row should be added to the table,
but for some reason this isn't happening.

However, if I refresh with the browser, the row is added.

Any ideas?
Thanks,
Magdolna





From: "magdolna holitska" <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Table refresh problem when using dialog
Date: Fri, 05 Jan 2007 12:01:27 -0500

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


_________________________________________________________________
Share your opinion and enter to win! Please complete this survey to enter into a draw for a grand prize of $500 or one of twenty $50 cash prizes. http://www.youthographyinsiders.com/R.aspx?a=116

Reply via email to