3 Replies Latest reply on Nov 18, 2008 6:51 PM by etirk

    rich:jquery tag lacks inclusion of scripts and stylesheets

    etirk

      When accessing the default startpage the rich:jquery tag does not include the jquery script.


      The following



      <rich:jQuery selector="document" query="ready(onReady())" />
      



      expands to



      <script type="text/javascript">//<![CDATA[
       {
           var selector = "document";
           try {
                selector = eval("selector}");
           } catch (e) {}
           jQuery(selector).ready(onReady());
      }
      //]]></script>



      However, if one jump to any other page using a commandLink, the jquery-tag expands correctly with all included scripts and stylesheets.
      The script tag is located in the template.xhtml file, that is used in both the start page and the other page that is accessed by the commandLink.
      Is it a GET/POST problem that prohibits the taglib from evaluating some parameters maybe?


      /K

        • 1. Re: rich:jquery tag lacks inclusion of scripts and stylesheets
          etirk

          Versions used: Seam: trunk as of today, Richfaces: 3.2.2.SR1.


          /K

          • 2. Re: rich:jquery tag lacks inclusion of scripts and stylesheets
            etirk

            Looking more closely on the code posted, I realized that the evaluation of selector looks very strange as well.
            There appears to be a wrongfully placed


            }



            in between the evaluation expression, aside from the lacking of script and css includes. This extra curl does not seem to prohibit the java script to execute though. But it should probably be removed.


            selector = eval("selector}");
            



            /K

            • 3. Re: rich:jquery tag lacks inclusion of scripts and stylesheets
              etirk

              To further clarify...
              Accessing the page the first time, the scripts are not included.
              Sometimes the richfaces tag include the scripts directly at the top of the page, directly after the head starting tag. Sometimes the
              tag seem to include it directly before the created jquery-script-block.
              However, the first access made to the page prints out the script-block, but the includes are not there.
              This seem to be the case for all rich-components added for the first page, start.xhtml.
              Adding a simpleTogglePanel for example results in the same behaviour. No styles, no scripts included first access to the page. The code for the togglepanel is printed correctly to the outputstream but the includes are just gone, and the control does not work.
              After other pages have been accessed and the page is accessed again by a commandLink or similar, the tags are rendered correctly, and all scripts and css are there.


              Anyone have any similar experiences?


              /K