A bit more follow up on this topic of taking action after an ajax load
call on the jDiv.
Right now the jDivLoad function in the provided web2py_ajax.html makes
the assumption that the command to be evaluated on completion of the
load will be provided by the web2py host application. As mentioned in
my other response to Wes, while I feel this is definitely a valuable
option for those who wish to control the flow of the client from the
host, in more complex apps where there is re-use of partials among web
pages, it may be preferable to control the flow of the client via
javascript in the client itself in order to have a looser coupling
between jDiv's.
Also, there are many cases where the function you wish to call upon
loading a jDiv is something other than the default provided by
jDivLoad (like auto selecting the first item in a list of items for
showing in another jDiv). Right now, this can be specified by jDiv.set
('command') on the host side prior to completing the request handler,
but, again, this requires that my request handler have knowledge of
the function in the view that will be called.
Since jDivLoad is wrapping up the jquery .ajax call for the
implementation of the load, can we have jDivLoad also accept
parameters for the jQuery .ajax beforeSend, success and complete
options and evaluate those commands along with the custom commands
that might be passed back from the host in the response? This would
allow the client more options for sophisticated behavior.
Ted
On May 1, 3:59 pm, Wes James <[email protected]> wrote:
> Right now with my time tracker i have:
>
> FormjDiv
> HoursjDiv
> Last20itemsjDiv
>
> When I submit FormjDiv it goes away (the lower part of the jDiv), but it
> refreshes HoursjDiv on the callback. At the end of the code for HoursjDiv i
> have it trigger FormjDiv to open it up again with a new form (like click the
> first top button) and also to refresh contents in Last20itemsjDiv.
>
> There's probably a better way to do this, but this works for now.
>
> -wj
>
> On Fri, May 1, 2009 at 4:52 PM, Ted G <[email protected]> wrote:
>
> > On a related note:
>
> > What is the best way to trigger a Javascript function upon a jDiv load
> > or form submit within a jDiv? For example:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---