10 Replies Latest reply on Nov 7, 2008 7:33 PM by nbelaevski

    Richfaces Calendar submitting and rerendering problem

    stty

      Hi! I'm working on a project using Richfaces Calendar.

      I've got a problem with submitting date selection - with popup="false" I need to send AJAX request doing two things:

      1) set up date "clicked" on the calendar into property of a bean

      (value = "#{tableBean.date}")

      2) rerender part of the page that needs this date already set up.

      The problem is that the date is always one day late. It looks like the calendar sends previously selected date. I can't find the good configuration of properties of the calendar... I have been tried many ways but with no success :-(

      Can anyone help mi?

        • 1. Re: Richfaces Calendar submitting and rerendering problem
          stty

          "one day late" - i mean "one selection late"

          • 2. Re: Richfaces Calendar submitting and rerendering problem
            ilya_shaikovsky

            use onchanged event to rise request.

            • 3. Re: Richfaces Calendar submitting and rerendering problem
              stty

              I have used "onchanged" and others events but if You write code like this:

              <a4j:support event="onchanged" actionListener="#{tableBean.load}" reRender="panelTable" />

              the situation is as described...

              load() function uses the date selected in the calendar (value = "#{tableBean.date}") to load data from database needed to rerender view.

              • 4. Re: Richfaces Calendar submitting and rerendering problem
                ilya_shaikovsky

                With RF 3.2.2GA and 3.3.0 snapshots - onchanged event fired after the date selected. And we've test this many times.. So the value which is applied - the new value.

                 <h:form>
                 <rich:calendar popup="false" id="cal">
                 <a4j:support event="onchanged" reRender="out"></a4j:support>
                 </rich:calendar>
                 <h:outputText id="out" value="#{rich:findComponent('cal').value}"/>
                 </h:form>
                


                This simple test updates value of output text after date selected.

                So please send simple war in order to reproduce your case if it possible.

                • 5. Re: Richfaces Calendar submitting and rerendering problem
                  stty

                  Thank you for answers.

                  I'm not sure I understood - I'll try today to use value="#{rich:findComponent('cal').value}"/> to send a parameter included in <a4j:support>. Than I'll give you an answer.

                  I've got another question: how to wrap long descriptions of leafs in <rich:tree>? I searched the documentation but without effect. I think there is a simple way to do that (like in Tomahawk library) but I didn't find it :-)

                  • 6. Re: Richfaces Calendar submitting and rerendering problem
                    ilya_shaikovsky

                     

                    I'm not sure I understood - I'll try today to use value="#{rich:findComponent('cal').value}"/> to send a parameter included in <a4j:support>. Than I'll give you an answer.


                    findComponent should not become an answer for you.. I've used it only in order not to create bean but just get current component value. So my point was just that using this code you could see that actual value submitted.

                    I've got another question: how to wrap long descriptions of leafs in <rich:tree>? I searched the documentation but without effect. I think there is a simple way to do that (like in Tomahawk library) but I didn't find it :-)


                    as it described in documentation - treeNode designed in order to define markup for concrete type of node. So you could create any markup inside and display the text as you need.

                    • 7. Re: Richfaces Calendar submitting and rerendering problem
                      stty

                      ilya - thank you - your advice about calendar was very helpful. Code working perfectly for me:

                      (...)

                      value = "#{tableBean.date}">
                      <a4j:support event="onchanged" reRender="panelTable" />



                      and in tableBean function

                      public void setDate(Date date) {
                      this.date = date;
                      load();
                      }


                      I still have the problem with the tree... I tried to enclose the command link in mentioned code with div, span, table using CSS but leafs still doesn't wrap :-(


                      <r:treeNode>

                      <a4j:commandLink value="[+] " rendered="#{!project.fastList}"
                      actionListener="#{treeBean.fastListInsert}" reRender="panelTree">
                      <c:attribute name="project" value="#{project}" />
                      </a4j:commandLink>

                      (...)

                      • 8. Re: Richfaces Calendar submitting and rerendering problem
                        stty

                        Just another question (i hope the last one :-) ) to this example:
                        http://livedemo.exadel.com/richfaces-demo/richfaces/calendar.jsf?tab=organizer
                        I try to send a list of objects into cell of calendar in many ways:

                        List<Report> reports = reporter.getReports(user, dates);
                        
                         item.setData(reports);
                         // or
                         item.setData(serializer.deepSerialize(reports)); // JSON
                         // or
                         data = new HashMap();
                         data.put("reports", reports);
                         item.setData(data);
                         // or
                         item.setData(serializer.deepSerialize(reports));
                        
                         items = item;


                        and use them in calendar:

                        <a4j:outputPanel id="cell" layout="block" style="height: 100%;">
                         <r:dataTable id="monthTable" styleClass="monthTable" width="75" value="{data}" var="report">
                         <r:column>
                         <h:outputText value="xxx" />
                         </r:column>
                         </r:dataTable>
                        </a4j:outputPanel>


                        or
                        value="{data.reports}"



                        but I've got:

                        org.apache.jasper.el.JspPropertyNotFoundException: (...)
                        '#{!report.fromJira}' Property 'fromJira' not found on type java.lang.String

                        What I'm doing wrong?


                        • 9. Re: Richfaces Calendar submitting and rerendering problem
                          stty

                          Sorry - last post is with mistake...

                          <r:column>
                           <h:outputText value="#{report.project.id}: #{report.task.name}" rendered="#{!report.fromJira}" />
                           <h:outputText value="#{report.project.id}: (Jira)" rendered="#{report.fromJira}" />
                           </r:column>


                          • 10. Re: Richfaces Calendar submitting and rerendering problem
                            nbelaevski