3 Replies Latest reply on Mar 14, 2008 5:48 PM by Eduard

    timing problem

    Eduard Newbie

      Hi everyone,
      I need your help with solving of the following problem.
      I have page where I search for users and display results in dataTable. Each user record has commandLink associated with it. This commandLink populates DataModelSelection in subscriberSearch component, starts conversation in reply component and opens modalPanel. modalPanel's subname and phone get their data from Subscriber object, outjected in subscriberSearch component.
      Everything works fine except that modalPanel opens before Subscriber is outjected. How do you normally solve this problem?

      Thanks, Ed

      <rich:modalPanel id="messagesendpanel" width="400" height="280" moveable="false" resizeable="false" left="auto" top="auto">
        <f:facet name="header">
          <h:outputText value="Initiate Conversation"/>
        <a:form id="messagesendform">
          <h:panelGrid id="sendmessagegrid" columns="2" columnClasses="name1,value1" style="width:100%">
            <h:outputLabel for="subname">Name:</h:outputLabel>
            <h:outputText id="subname" value="#{subscriber.name}"/>
            <h:outputLabel for="phone">Phone:</h:outputLabel>
            <h:outputText id="phone" value="#{subscriber.mobile[0].phone}"/>
            <h:outputLabel value="" for="btncell"  style="padding-top:5px;padding-bottom:5px;"></h:outputLabel>
              <h:panelGroup id="btncell" style="padding-top:5px;padding-bottom:5px;">
                <a:commandLink oncomplete="Richfaces.hideModalPanel('messagesendpanel')" 
               <a:commandLink id="sendmessagelink" 
      <a:form id="subsform">                                                     
          <h:outputText value="No Subscribers Found" rendered="#{subscribers != null and subscribers.rowCount==0}"/>
          <h:dataTable class="zebra" value="#{subscribers}" var="s" rendered="#{subscribers.rowCount>0}" rowClasses="odd,even">
              <f:facet name="header">First Name</f:facet>
              <a:region id="cmdlink1">
                <a:commandLink ajaxSingle="true" 
                               reRender="phone, carrier"
                <a:status for="cmdlink1" 
      public class SubscriberSearchingAction implements SubscriberSearching {
        private EntityManager em;
        private Subscriber subscriber;
        private List<Subscriber> subscribers;
      public class ReplyBean implements Reply {
        @In(scope=ScopeType.SESSION, required=false)
        private Subscriber subscriber;
        public void init() {

        • 1. Re: timing problem
          Keith Naas Novice

          Make the selected subscriber a property on the SubscriberSearchingAction (just add a getter).  Then try referring to it using the property based notation

          <h:outputText id="subname" value="#{subscriberSearching.subscriber.name}"/>
                <h:outputLabel for="phone">Phone:</h:outputLabel>
                <h:outputText id="phone" value="#{subscriberSearching.subscriber.mobile[0].phone}"/>

          Does it work now?

          • 2. Re: timing problem
            Joseph Nusairat Newbie

            Let me just say i am not sure if this the solution

            But i dont think it outjecting first is the problem per se. I think it may be that your area just isn't be re-rendered by the server itself.

            I have not used the oncomplete yet ... i usually just rerender areas.

            But dont you need to surround the area you are updating with an a4j:support .... so that it will do a partial page refresh of the area? Without it i didnt think the rich faces is doing anything Ajaxy by itself.

            At least thats what i have to do in all my areas of re-rendering.

            • 3. Re: timing problem
              Eduard Newbie

              Thanks Keith. I thought of this right after I posted the question, and yes - it worked.

              I would still like to find another (cleaner) way of doing it.