1 2 Previous Next 19 Replies Latest reply on Jun 15, 2009 9:54 AM by elf Go to original post
      • 15. Re: Rich Calendar and Ajax support
        ilya_shaikovsky

        do you able to share complete sample sources? I will work on corrections and share the results there then.

        • 16. Re: Rich Calendar and Ajax support
          elf

          Here is my code:
          1.

          <rich:page xmlns="http://www.w3.org/1999/xhtml"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:rich="http://richfaces.org/rich"
           xmlns:a4j="http://richfaces.org/a4j"
           markupType="xhtml" contentType="text/html" theme="simple"
           sidebarWidth="350" sidebarPosition="right" pageTitle="#{mngr.smallPortalName}" id="PORTAL_MAIN_PAGE">
          
           <f:facet name="header">
           <h:outputText value="#{mngr.portalName}" />
           </f:facet>
          
           <f:facet name="sidebar">
           <h:outputText value="" />
           </f:facet>
          

          2.
           public String getPortalName() {
           UIHelper.updatePortal(this);
           return UIHelper.getResLabels().getString("portalName");
           }
          

          3.

          public static void updatePortal(PortalManager man){

          FacesContext fc = FacesContext.getCurrentInstance();
          UIComponent pP = fc.getViewRoot().findComponent(PORTAL_MAIN_PAGE);

          ((HtmlPage)pP).getFacets().put("sidebar", getSideBar(man));

          4.

          AjaxForm f = new AjaxForm();
          HtmlCalendar orgCal = new HtmlCalendar();
          orgCal.setPopup(false);
          orgCal.setValueExpression("value",
          eF.createValueExpression(eC, "#{" + DataBinding.BINDING_BEAN_NAME + ".orgDate}", Date.class));
          orgCal.setValueExpression("binding",
          eF.createValueExpression(eC, "#{" + DataBinding.BINDING_BEAN_NAME + ".organizerDate}", UICalendar.class));

          orgCal.setMode("ajax");

          HtmlAjaxSupport as = new HtmlAjaxSupport();
          as.setEvent("onchanged");
          as.addActionListener(new OrganizerValueChangeListener());

          orgCal.getFacets().put("onchanged", as);

          f.getChildren().add(orgCal);


          return f;

          I tried to use different mode for calendar object, different form object, different bean scopes, but looks like problem is in wrong sidebar creating.

          • 17. Re: Rich Calendar and Ajax support
            nbelaevski

            Do not recreate components on each get* call.

            • 18. Re: Rich Calendar and Ajax support
              elf

              sidebar created only once, when page loading ...

              • 19. Re: Rich Calendar and Ajax support
                elf

                 

                "ilya_shaikovsky" wrote:
                do you able to share complete sample sources? I will work on corrections and share the results there then.

                ilya, is there any news on this ?

                1 2 Previous Next