wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marios Skounakis <msc...@gmail.com>
Subject Passing parameters from java code to global ajax call listeners
Date Thu, 25 Jul 2013 22:40:34 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message