Re: Complex popup with JQuery

"Esteban A. Maringolo" <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <CAJMgPCKd9=XuJcFqVDoJKgZecT+mhQiFdbL1tiaHf2EQ-Ls3qg@mail.gmail.com>
2018-03-17 4:12 GMT-03:00 [email protected] <[email protected]>:
> Bruno,
>
> if you do a
>
> (html ajax callback: ()) onComplete:(html jQuery: idOfRootCompForRedraw)
> load html: [html render: rootComponentForRedraw]
>
> (not tested, just from my head)

The "fixed" version would be something like this:

onClick: ((html jQuery ajax callback: ["..."]) onComplete: (
                 (html jQuery id: idOfRootCompForRedraw)
                   load html: [:h | h render: rootComponentForRedraw]))

Another alternative is to execute the callback within a script
response, saving one extra HTTP roundtrip for the "onComplete".

onClick: (html jQuery ajax script: [:s |
                "your callback actions".
                (html jQuery id: idOfRootCompForRedraw) html: [:h | h
render: rootComponentForRedraw]
               ])

> this should redraw the complete subtree of rootComponentForRedraw. If this
> component is inside your popup, the popup will be redrawn. So you do do
> both: just redraw individual components or redraw complex component trees.

I managed to get a similar behavior using Bootstrap's Popover plugin
<https://getbootstrap.com/docs/3.3/javascript/#popovers>, where the
popover is dynamically attached and its content is loaded from the
server once opened (so you get an "updated" content every time you
open it).

> One thind to keep in mind, however, is that you need to be careful when
> using forms in popups. A Form will only submit its own contents, and it
> will redraw the whole page. So forms with submitbuttons etc. are a no-go
> for popups, or you need to work some JS magic around that.

Submit buttons cause a full page reload, unless you handle the submit
event and return false at the end.
Why I do these days is submit almost everything using
#serializeChildren: on the form, triggered by a button or anchor that
IS NOT a submit button.

There are a lot of "recipes" like this that we should share in the
Seaside wiki or somewhere.

Regards,
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.