preHook initial problem?

View: New views
3 Messages — Rating Filter:   Alert me  

preHook initial problem?

by andle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: preHook initial problem?

by Michael Benz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...


Re: preHook initial problem?

by Michael Benz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oops, should have read:
preHook:function() { showLoadText(obj, loadText); }

since preHook is called with no args.

Cheers,
Michael


Michael Benz schrieb:

> 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@...
>
>


--

. frankfurt am main, 14°c, zur zeit ein wenig
  bewölkt in 975 m. die sichtweite reicht weiter als
  10 km.

< michael benz
  michael.benz@...
  t +49 69 759003 0

  wemove digital solutions gmbh
  eschersheimer landstr. 5-7
  60322 frankfurt am main

  amtsgericht frankfurt am main, hrb 53992
  geschäftsführer joachim müller, stefan hartmann

  wemove digital solutions
  www.wemove.com




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