[Seaside] Re: Differences in calling render: from ajax?
tamackinnon at gmail.com
Thu Aug 12 12:01:40 UTC 2010
On 2010-08-12 08:41:38 +0100, Johan Brichau said:
> Do you mean that the second html snippit is the replacement that
> isgenerated when you click the button (and have the replace
> scriptexecuting) ?
Yes the 2nd snippet is the replacement generated on the click and it is
missing the s,k params (refreshing the whole page restores them)
> I notice that you are not using the s parameter in your ajax
> scriptcallback. Where are you calling the #ajaxReplaceWith: method? Is
> this inthe #removeToken: method? And how are you constructing the
I am reacting to a model change announcement (whose source is from
another ajax call - the button click to remove an item), so the chain
looks like this:
generateUpdateScriptWith: jsScript jQuery) ]
^(self waitersView ajaxReplaceWith: aJQuery) , (self holderView
then both components inherit the following:
^ (aJSQuery id: myId) replaceWith: [ :r | r render: self ]
> My guess is that you hit a problem that is identical to the
> onementioned in the 'important' box
> If you are generating another ajax callback, the renderContext (and
> thusactionUrl, etc...) are wrong.
I think you are right - but from the above I am passing on a fresh
JQuery object, and then using it to do the double dispatch on the
I think this is related to your? comet thread - it feels like there is
a neat way to do this, but I haven't got my head around it yet. The
above all worked fine until I had to render new callbacks into the code
for my buttons.
I'm not sure what line of attack to experiment with next?
> On 12 Aug 2010, at 01:17, Tim Mackinnon wrote:
>> So I was making great progress until I descided to render removebuttons
>> with items in my subcomponent.
>> When I initially render my component I have something like this:
>> renderContentOn: html
>> (html div)
>> self contentModel tokenWaitersDo: [ :item | html tableRow:[ i := i + 1.
>> html tableData: [ html text: item name ];
>> tableData: [html button onClick: (htmljQuery ajax
>> script: [:s| self removeToken: i]); value: 'Remove' ] ] ] ] ] ]
>> And I get something in my page like this:
>> <button class="submit"
>> click on my remove button - I end up doing something like:
>> ajaxReplaceWith: aJSQuery
>> ^ (aJSQuery id: myId) replaceWith: [ :r | r render: self ]
>> But it generates the following:
>> <button class="submit"
>> I picked up the above fragment from some mal message answer byLukas -
>> and it was working well, but notice how the url parameter iswrong - its
>> not /element with the k and s paramters???
>> Is this because render: is not rendering in the context of a
>> childcomponent? And is there some other way of re-rendering my
>> component byan ajax call? I think Julian had an example in the comet
>> thread - maybeI can get that to work?
>> Any help greatly appreciated.
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
More information about the seaside