I did this in pure Javascript for a recent project. You can insert
this code into your base page or whatnot. Its basically a hidden div
that you hide/show and you can style it however. You can see it in
action at http://www.pnc.net/. In my case its just a quick
'Loading...' text blurb in the top right of the window. I stole this
from 
:http://cwiki.apache.org/WICKET/generic-busy-indicator-for-both-ajax-and-non-ajax-submits.html

html:
-------
<div id="bysy_indicator">Loading ...</div>

js:
-------
    <script type="text/javascript">
 window.onload = setupFunc;

 function setupFunc() {
   document.getElementsByTagName('body')[0].onclick = clickFunc;
   hideBusysign();
         Wicket.Ajax.registerPreCallHandler(showBusysign);
         Wicket.Ajax.registerPostCallHandler(hideBusysign);
         Wicket.Ajax.registerFailureHandler(hideBusysign);
 }

 function hideBusysign() {
   document.getElementById('bysy_indicator').style.display ='none';
 }

 function showBusysign() {
   document.getElementById('bysy_indicator').style.display ='inline';
 }

 function clickFunc(eventData) {
   var clickedElement = (window.event) ? event.srcElement : eventData.target;
   if (clickedElement.tagName.toUpperCase() == 'BUTTON' ||
clickedElement.tagName.toUpperCase() == 'A' ||
clickedElement.parentNode.tagName.toUpperCase() == 'A'
     || (clickedElement.tagName.toUpperCase() == 'INPUT' &&
(clickedElement.type.toUpperCase() == 'BUTTON' ||
clickedElement.type.toUpperCase() == 'SUBMIT'))) {
     showBusysign();
   }
 }
</script>



On Tue, Sep 8, 2009 at 8:13 AM, tubin gen<[email protected]> wrote:
> I am looking for some indicator for any ajax requests , I dont want to add
> the behaviour for every component with ajax behaviour , I want something
> which detects for ajax request and starts the indicator blocking the page
> for further user actions and vanishess after  response is rendered is there
> any?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to