2 Replies Latest reply on Apr 16, 2008 2:53 PM by john hedden

    a4j:poll and limitToList

    john hedden Newbie

      I have a parent/child popup which updates the model and closes. This page should then get updated via a4j:poll but the list doesnt get updated until I either try and sort or refresh the page. If I remove "limitToList" then it renders but cause all kinds of seam conversation issues on "Save". Any ideas?

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:a="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       template="/WEB-INF/templates/template.xhtml">
      
       <ui:define name="body">
      
       <a:outputPanel ajaxRendered="true">
       <h:messages styleClass="message" globalOnly="true"/>
       </a:outputPanel>
      
       <a:region>
       <h:form>
       <a:poll id="poll" interval="500" enabled="true" reRender="contactList, fileList" limitToList="true"/>
       </h:form>
       </a:region>
      
       <rich:panel>
       <f:facet name="header">Create Order</f:facet>
       <h:form id="orderForm">
      
       <rich:panel style="width:600px">
       <f:facet name="header">Customer Information</f:facet>
       <h:panelGrid columns="1" width="100%">
       <s:decorate id="customerTypeDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">Customer Type:</ui:define>
       <h:selectOneRadio id="customerType" value="#{order.customer.customerType}">
       <s:convertEnum />
       <s:enumItem enumValue="NEW" label="New" />
       <!-- <s:enumItem enumValue="EXISTING" label="Existing" /> -->
       <!-- <a:support ajaxSingle="true" event="onchange" reRender="ajaxPanel" /> -->
       </h:selectOneRadio>
       </s:decorate>
      
       <s:decorate id="newCustomerDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">Customer Name:</ui:define>
       <h:inputText id="newCustomer" value="#{order.customer.orgShortName}" required="true">
       <a:support event="onblur" reRender="newCustomerDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="orderNumberDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">Order Number:</ui:define>
       <h:inputText id="orderNumber" value="#{order.orderNumber}" required="true">
       <a:support event="onblur" reRender="orderNumberDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="initServiceDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">Initial Service Date:</ui:define>
       <rich:calendar id="initialServiceDate" datePattern="MM/dd/yyyy" required="true"
       event="onblur" reRender="initServiceDecorate" style="width: auto;"
       value="#{order.initialServiceDate}"/>
       </s:decorate>
      
       <s:decorate id="ihodDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">IHOD:</ui:define>
       <rich:calendar id="ihod" datePattern="MM/dd/yyyy" required="true"
       event="onblur" reRender="ihodDecorate" style="width: auto;"
       value="#{order.ihod}"/>
       </s:decorate>
      
       <s:decorate id="productDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">Product:</ui:define>
       <h:inputText id="product" value="#{order.product}" required="true">
       <a:support event="onblur" reRender="productDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="mmrDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">Avg MMR:</ui:define>
       <h:inputText id="mmr" value="#{order.avgMMR}" required="true">
       <a:support event="onblur" reRender="mmrDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <rich:spacer height="20"/>
      
       <s:decorate template="/WEB-INF/templates/display.xhtml">
       <ui:define name="label">#{messages.billing_information}</ui:define>
       </s:decorate>
      
       <s:decorate id="address1Decorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">#{messages.address1}:</ui:define>
       <h:inputText id="address1" value="#{order.customer.billTo.address1}" required="true">
       <a:support event="onblur" reRender="address1Decorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="address2Decorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">#{messages.address2}:</ui:define>
       <h:inputText id="address2" value="#{order.customer.billTo.address2}">
       <a:support event="onblur" reRender="address2Decorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="cityDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">#{messages.city}:</ui:define>
       <h:inputText id="city" value="#{order.customer.billTo.city}" required="true">
       <a:support event="onblur" reRender="cityDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="stateDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">#{messages.state}:</ui:define>
       <h:inputText id="state" value="#{order.customer.billTo.state}" required="true">
       <a:support event="onblur" reRender="stateDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="zipDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">#{messages.zip}:</ui:define>
       <h:inputText id="zip" value="#{order.customer.billTo.zip}" required="true">
       <a:support event="onblur" reRender="zipDecorate" bypassUpdates="true"/>
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="countryDecorate" template="/WEB-INF/templates/edit.xhtml">
       <ui:define name="label">#{messages.country}:</ui:define>
       <h:selectOneMenu id="country" value="#{order.customer.billTo.country}" required="true">
       <s:convertEntity/>
       <s:selectItems value="#{countries}" var="country" label="#{country.printableName}"
       noSelectionLabel="Please select.." />
       <a:support event="onchange" reRender="countryDecorate" bypassUpdates="true"/>
       </h:selectOneMenu>
       </s:decorate>
       </h:panelGrid>
       </rich:panel>
      
       <rich:spacer height="20"/>
      
       <!-- Contacts -->
       <rich:panel>
       <f:facet name="header">Contacts</f:facet>
       <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       value="#{order.contactList}" var="contact" id="contactList" rows="5"
       width="100%">
       <f:facet name="header">#{messages.contacts}</f:facet>
       <rich:column sortBy="#{contact.contactType}">
       <f:facet name="header">#{messages.contact_type}</f:facet>
       <h:outputText value="#{contact.contactType}"/>
       </rich:column>
       <rich:column sortBy="#{contact.firstName}">
       <f:facet name="header">#{messages.first_name}</f:facet>
       <h:outputText value="#{contact.firstName}"/>
       </rich:column>
       <rich:column sortBy="#{contact.lastName}">
       <f:facet name="header">#{messages.last_name}</f:facet>
       <h:outputText value="#{contact.lastName}"/>
       </rich:column>
       <rich:column>
       <f:facet name="header">#{messages.phone}</f:facet>
       <h:outputText value="#{contact.phone}"/>
       </rich:column>
       <rich:column>
       <f:facet name="header">#{messages.fax}</f:facet>
       <h:outputText value="#{contact.fax}"/>
       </rich:column>
       <rich:column>
       <f:facet name="header">#{messages.email}</f:facet>
       <h:outputText value="#{contact.email}"/>
       </rich:column>
       </rich:dataTable>
       <rich:spacer height="10"/>
       <s:link id="addContact" value="Add Contact"
       action="#{contactManager.addContact()}" target="_blank"/>
       </rich:panel>
      
       <rich:spacer height="20"/>
      
       <!-- Attachments -->
       <rich:panel>
       <f:facet name="header">Attachments</f:facet>
       <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       value="#{order.uploadFileList}" var="file" id="fileList" rows="5"
       width="100%">
       <f:facet name="header">Files</f:facet>
       <rich:column>
       <f:facet name="header">File Name</f:facet>
       <h:outputText value="#{file.fileName}"/>
       </rich:column>
       <rich:column>
       <f:facet name="header">Content Type</f:facet>
       <h:outputText value="#{file.contentType}"/>
       </rich:column>
       <rich:column>
       <f:facet name="header">Size</f:facet>
       <h:outputText value="#{file.size}"/>
       </rich:column>
       </rich:dataTable>
       <rich:spacer height="10"/>
       <s:link id="addAttachment" value="Add Attachment"
       action="#{attachmentManager.addAttachment()}" target="_blank"/>
       </rich:panel>
      
       <rich:spacer height="20"/>
      
       <!-- Buttons -->
       <h:panelGrid columns="1" width="100%" columnClasses="alignRight">
       <h:panelGroup style="display:block; text-align:right">
       <s:button id="cancel" action="#{orderManager.cancel()}" value="Cancel"/>
       <h:commandButton id="save" action="#{orderManager.saveOrder()}" value="Save"/>
       </h:panelGroup>
       </h:panelGrid>
      
       </h:form>
       </rich:panel>
      
       </ui:define>
      </ui:composition>