-
1. Re: invoke action after completion of page load
daniel.soneira Jul 11, 2008 4:20 AM (in response to the_cthulhu)You could try a combination of jQuery (onReady) calling an a4j:jsFunction that triggers the loading of the data - with an aj4:status onstart showing some "loading" div - hiding it in onstop again.
So your page would show up - when the DOM is built (rich:jQuery timing="onload") you invoke your data loading function (a4j:jsFunction) as an AJAX request - while that function is working in the background you display some status information (a4j:status onstart / onstop) -
2. Re: invoke action after completion of page load
the_cthulhu Jul 11, 2008 6:54 AM (in response to the_cthulhu)that sounds like a more elegant approach without the possbility of being DDOSed by the users because of the poll not beeing disabled.
I tried the following:<rich:jQuery timing="onload" query="eval()"></rich:jQuery> <h:form> <a4j:jsFunction name="eval" action="#{userRecBox.evaluate()}" reRender="userRecommendationResult"> </a4j:jsFunction> </h:form>
this leads to the strange error:An Error Occurred: Property 'evaluate' not found on type de.nightcrawler.session.box.userRecommendation.UserRecBox_$$_javassist_3
My first thought was that the action is not called properly but some property. I created a delegate Method "getEvaluate()" in userRecBox but this changes nothing.
Some idea? -
3. Re: invoke action after completion of page load
the_cthulhu Jul 11, 2008 7:11 AM (in response to the_cthulhu)problem solved!
sorry, I tinkered with the old poll code and jsut commented it out, but it was still parsed I think ;) -
4. Re: invoke action after completion of page load
the_cthulhu Jul 13, 2008 8:37 AM (in response to the_cthulhu)very strange behviour ;)
So, the above code works perfectly, but only für the jsFunction eval. This overrides the javascript eval function that is called in the generated jQuery:jQuery(document).ready(function() { var selector = 'page'; try { selector = eval(""); } catch (e) {} jQuery(selector).eval();
So the actual method invocation is done in line 4 and not in the last line.
Any clues how to solve this problem? -
5. Re: invoke action after completion of page load
daniel.soneira Jul 14, 2008 4:28 AM (in response to the_cthulhu)Naming a JS function "eval" is somewhat dangerous, as it is already a function standard Javascript function.
I would go for another name [I'll use "youreval" in the example below]
The problem here is that you didn't use a jQuery API function name (like "each", "toggle", ...) in the "query" argument.
Try something like this:<rich:jQuery selector="document" timing="onload" query="each(function () {youreval();})"/>
This will invoke the inline callback function for every element that matches your selector (which should be your document - so only invoked once). -
6. Re: invoke action after completion of page load
the_cthulhu Jul 14, 2008 4:39 AM (in response to the_cthulhu)Great, Thank you!
I wasn't accustomed to jQuery so I didn't have this great idea.
Works fine, thank you very much!