Hi all,

I am subscribing to the global ajax call listeners to show and hide a veil
during ajax calls. The veil is displayed during all ajax calls. I want a
way for some components / ajax behaviors to opt our from the veil.

What I'm doing now is adding an extra parameter to the ajaxAttributes and I
am checking for it in the beforeSend listener as shown in the code below.

Is there a better way to handle this?

-- setup

Wicket.Event.subscribe('/ajax/call/beforeSend', function( attributes,
jqXHR, settings ) {
       showBusysign(jqXHR)
        });
   Wicket.Event.subscribe('/ajax/call/complete', function( attributes,
jqXHR, textStatus) {
       hideBusysign()
        });

-- showing the veil:
function showBusysign(jqXHR) {
     if(typeof jqXHR.ep != 'undefined') {
         for (i=0; i<jqXHR.ep.length; i++) {if (jqXHR.ep[i].name =
'noveil') {return;}};
     }
    // go ahead and show the veil

-- java code:
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
                super.updateAjaxAttributes(attributes);
                attributes.getExtraParameters().put("noveil", "1");
            }


Thanks in advance,
Marios

Reply via email to