[Seaside] Calling a JQuery enabled component from an anchor callback

Lukas Renggli renggli at gmail.com
Sat Apr 18 16:10:15 UTC 2009


> This is the snippet from the table row render that has the anchor :-
>
>        html tableRow id: id; with:
>                [html
>                        tableData: [html anchor callback: [html render: self
> testComponent]; with: 'Edit'];
>                        tableData: aJulietUser role;

The problem with the above code is that when the callback is executed
the reference to the html canvas is not valid anymore. Remember, the
callback is only evaluated later, after the page has been renderer and
sent of to the web browser.

A possible solution would be to use an jQuery load action that on a
specific DOM element. This gives you a new html renderer to render on.
Try something along and check out other examples like
JQCounterFunctionalTest:

  " an empty div that will be the target of the rendering "
  html div id: 'dialogTarget'.

  " the anchor triggering the dialog (the jQu"
  html anchor
    onClick: ((html jQuery: 'dialogTarget') load
      html: [ :r | r render: self textComponent ]));
    with: 'Edit'

Btw, there is a Slime rule that detects when you accidently use a
wrong renderer.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list