I am trying to overlay a mask div during an ajax call but there is obviously
something I don't understand. I would appreciate any advice.

If I do the following in my ajax button subclass, the mask gets displayed
but never hidden. The order of the script parameter versus my style string
makes no difference:

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
        return new IAjaxCallDecorator()
        {
                public CharSequence decorateScript(CharSequence script)
                {
                        return
"document.getElementById('progressmask').style.zIndex='2';"+script;
                }
                public CharSequence decorateOnFailureScript(CharSequence script)
                {
                        return
script+"document.getElementById('progressmask').style.zIndex='-1';";
                }
                public CharSequence decorateOnSuccessScript(CharSequence script)
                {
                        return
script+"document.getElementById('progressmask').style.zIndex='-1';";
                }
        };
}

If I do the following, the mask is never displayed because all the
processing happens before the ajax targets are updated:

Page constructor:

bodyContainer.add(progressMask = new WebMarkupContainer("progressmask"));
progressMask.setOutputMarkupId(true);
progressMask.add(new AttributeModifier("class", new PropertyModel(this,
"progressMaskClass")));

Where progressMaskClass sets the CSS class to one that contains either
"z-index:2" or "z-index:-1".

My ajax button calls this method in the page class at the start of its
onSubmit: 

public void showProgress(AjaxRequestTarget target)
{
        progressMaskClass = "progressMaskVisible";
        target.addComponent(progressMask);
}

My ajax button calls this method in the page class at the end of its
onSubmit: 

public void closeProgress(AjaxRequestTarget target)
{
        progressMaskClass = "progressMaskHidden";
        target.addComponent(progressMask);
}

What am I doing wrong?
Thanks,
Julian

-- 
View this message in context: 
http://www.nabble.com/Overlay-div-on-ajax-call-tp15485027p15485027.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to