« Return to Thread: preHook initial problem?

Re: preHook initial problem?

by Michael Benz :: Rate this Message:

Reply to Author | View in Thread

Hi Andreas,
i believe you have an error in your js code. The preHook/postHook
arguments have to be functions just like the callback argument.
Otherwise your functions 'showLoadText' and 'hideLoadText' are evaluated
beforehand and the result set to preHook/postHook (which i assume is
undefined).

The code should look more like this:

AjaxMethods.findByCountryId(countryId, {
  callback:function(data) { afterAjax(data); },
  preHook:function(obj, loadText) { showLoadText(obj, loadText); }
  });
}

Michael


andle schrieb:

> I have problem with preHook not working the first time the ajax request is
> called.
> The showLoadText shows text in the current object (a listbox is in this
> case)
> while the server is taking care of my request.
> Do I have to set some initial stuff with dwr.engine.setPreeHook(...)
> and dwr.engine.setPostHook(...)?
>
> I have this in my jsp-page:
> AjaxMethods.findByCountryId(countryId, {
>   callback:function(data) { afterAjax(data)},
> preHook:showLoadText(obj, loadText),
> postHook:hideLoadText(obj),
> errorHandler:function(msg){ listBoxErrorHandler(obj)}
> });
> }
>
> /Andreas
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: preHook initial problem?