Hi all,
I am learning seaside and I am stuck with this code: html table id: 'conceptslist'; with: [ html tableRow class: 'header'; with: [ html tableData with: [ html text: 'Title' ]]. self blogModel concepts do: [ :ea | html tableRow with: [ html tableData with: [ html anchor onClick: (html ajax id: ('concept',ea id asString); callback: [ :r | self editConcept: ea on: r ]); with: ea title. html div id: ('concept',ea id asString) ]]]] No matter what I try, when I click any of the rendered links, editConcept:on: is called with last member of concepts collection. When I was using normal callback (not scriptaculous stuff), everything worked. Thanks, Jaroslav Cmunt _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> -----Original Message-----
> From: [hidden email] > [mailto:[hidden email]] On Behalf > Of Jaroslav Cmunt > Sent: Wednesday, April 12, 2006 11:46 AM > To: [hidden email] > Subject: [Seaside] Links list > > Hi all, > I am learning seaside and I am stuck with this code: > > html table id: 'conceptslist'; with: [ > html tableRow class: 'header'; with: [ > html tableData with: [ html text: 'Title' ]]. > self blogModel concepts do: [ :ea | > html tableRow with: [ > html tableData with: [ > html anchor > onClick: (html ajax > id: > ('concept',ea id asString); > callback: [ :r > | self editConcept: ea on: r ]); > with: ea title. > html div id: ('concept',ea id asString) ]]]] > > No matter what I try, when I click any of the rendered links, > editConcept:on: is called with last member of concepts collection. > When I was using normal callback (not scriptaculous stuff), > everything worked. > > Thanks, > Jaroslav Cmunt I'm guessing you're assuming that callback: [ :r | self editConcept: ea on: r ] is a closure and should remember each, and I'm guessing that callback: [ :r | self editConcept: ea on: r ] fixTemps Will solve your problem. In this scenario, ea is actually a method level variable. Blocks aren't yet full closures in squeak, YET. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Yes, that fixed the problem, thanks. Now I see that anchorWithAction:
that I tried before fixes the context for user. Maybe this call should do it too? I have followed the call using debugger, and WACallbackRegistry>>registerActionCallback: does indeed fix the context, but unfortunately not of the block passed to SUAjax>>callback:, but of the new block that SUAjax>>callback: creates from the one that I passed to it. On 4/12/06, Ramon Leon <[hidden email]> wrote: > I'm guessing you're assuming that > > callback: [ :r | self editConcept: ea on: r ] > > is a closure and should remember each, and I'm guessing that > > callback: [ :r | self editConcept: ea on: r ] fixTemps > > Will solve your problem. In this scenario, ea is actually a method level > variable. Blocks aren't yet full closures in squeak, YET. Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jaroslav Cmunt
> Yes, that fixed the problem, thanks. Now I see that anchorWithAction:
> that I tried before fixes the context for user. Maybe this > call should do it too? I have followed the call using debugger, and > WACallbackRegistry>>registerActionCallback: does indeed fix the > context, but unfortunately not of the block passed to > SUAjax>>callback:, but of the new block that SUAjax>>callback: creates > from the one that I passed to it. Any time you use a block in a loop, and store a reference to :each, you'll need to fixTemps, very common thing to keep in mind. But callback: doesn't always need fixTemps, only when it's used in this particular scenario. 3.9 should have full block closures so this shouldn't be a problem in the future. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Scriptaculous-lr.65 fixes the issue.
On 4/12/06, Ramon Leon <[hidden email]> wrote: > > Yes, that fixed the problem, thanks. Now I see that anchorWithAction: > > that I tried before fixes the context for user. Maybe this > > call should do it too? I have followed the call using debugger, and > > WACallbackRegistry>>registerActionCallback: does indeed fix the > > context, but unfortunately not of the block passed to > > SUAjax>>callback:, but of the new block that SUAjax>>callback: creates > > from the one that I passed to it. > > Any time you use a block in a loop, and store a reference to :each, > you'll need to fixTemps, very common thing to keep in mind. But > callback: doesn't always need fixTemps, only when it's used in this > particular scenario. 3.9 should have full block closures so this > shouldn't be a problem in the future. > > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Ramon Leon
2006/4/12, Ramon Leon <[hidden email]>:
> 3.9 should have full block closures so this > shouldn't be a problem in the future. Although this isn't actually wrong, it's neither fully true. In 3.9 you're able to load the new compiler without problems and this one has an optional closure mode. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jaroslav Cmunt
> -----Original Message-----
> From: [hidden email] > [mailto:[hidden email]] On Behalf > Of Philippe Marschall > Sent: Wednesday, April 12, 2006 2:03 PM > To: The Squeak Enterprise Aubergines Server - general discussion. > Subject: Re: [Seaside] Links list > > 2006/4/12, Ramon Leon <[hidden email]>: > > 3.9 should have full block closures so this shouldn't be a > problem in > > the future. > > Although this isn't actually wrong, it's neither fully true. > In 3.9 you're able to load the new compiler without problems > and this one has an optional closure mode. Ah, my bad, I thought it was going to be standard, not just an option. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |