4 Replies Latest reply on Dec 13, 2010 9:04 AM by Nick Belaevski

    Load RichFaces resources when a page is loaded trough an AJAX call.

    Cristian Mastrantono Newbie

      Hi everyone... I think I have a problem a little complex.

       

      To make it easier, I have a page called index.jsp (I'm using JSF) with only a OutputLink and a DIV with id="myBlock". When the user clicks on the OutputLink, I use an AJAX call to send a request to the server looking for the "richPage.jsf".

       

      When the request is solved, the response given by the server is embebed to the page in this way:

       

      document.getElementById("myBlock").innerHTML = req.responseText;

       

      Everything goes well and looks fine, until I tried to do some stuff with the RichFaces components that were suposed to be on the page. Actually, the components are rendered on the page, but are unusable. It's like they are there, but with no behavior.

       

      I think the problem is basically with the JS used by the components (e.g. Rich:Calendar or Rich:TabPanel). My guess is that no resources are loaded when I make that call.

       

      What I tried so far?

       

      On the "index.jsp" and "richPage.jsp" stated (with no result):

           <a4j:loadScript src="resource:///org/ajax4jsf/framework.pack.js" />

           <a4j:loadStyle src="resource:///org/richfaces/ui.pack.js" />

       

      Web.XML

           <context-param>

          <param-name>org.richfaces.LoadScriptStrategy</param-name>

          <param-value>NONE or ALL</param-value>

           </context-param>

       

      After these tests, the TabPanel and the Calendar are unusable...

       

      I still believing that resources that were suposed to be loaded when "richPage.jsp" is invoked, aren't loaded... so I´m wondering if there is any way to load them manually...

       

      Anyone have some guess??

      <f:view locale="es">
      <h:form id="formPrincipal">
      <h:outputLink id="misPendientes" value="#" onclick="javascript:abrirVistaNew('vistas/view.jsf?viewId=2&searchString=');"  >
      <b><h:outputText value="ABRIR!"/></b>
      <rich:toolTip>Un Tooltip</rich:toolTip>
      </h:outputLink>
      <div>---------------------------------------------------------</div>
      <t:div id="frameContenidos">
      <div id="frameContenido"></div>
      </t:div>
      </h:form>
      </f:view>