Mats Norén wrote:
Hi,
I've been searching the archives on a simple way to repaint a
component from a non-wicket javascript, ie the javascript is not
attached or associated with a wicket component.
The usecase:
1. A user updates data in the browser (non wicket)
2. Presses save (could be a wicket component)
3. An ajax-call is made to update a datasource (non wicket call)
4. Success-handler should repaint a wicket component
In 2 I tried with an AjaxButton and
requestTarget.prependJavascript("doAjaxSaveInOtherLibrary()")..
The problem with that is the timing. The prepended javascript function
returns and then the wicket ajaxcall gets executed before the
success-handler in the non wicket library...
I guess what I'm looking for is a simple way to add a markupcontainer
with an AbstractDefaultAjaxBehavior that I can reference from my non
wicket javascript.
Hi Mats,
how about this (pseudo code):
componentYouWantToPressOnForSave.add(new AjaxEventBehavior("onclick")
{
protected CharSequence getCallbackScript(boolean
onlyTargetActivePage)
{
return
generateCallbackScript("doAjaxSaveInOtherLibrary('" +
getCallbackUrl(onlyTargetActivePage) +
"'");
}
);
than you can decide if you want to initiate the AjaxCall to the
AjaxEventBehavior or not.
Just call
wicketAjaxGet(callbackUrl)
somewhere in your JavaScript on success-handler.
mf
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]