[Seaside] Differences in calling render: from ajax?
Johan Brichau
johan at inceptive.be
Thu Aug 12 07:41:38 UTC 2010
Hi Tim,
Do you mean that the second html snippit is the replacement that is generated when you click the button (and have the replace script executing) ?
I notice that you are not using the s parameter in your ajax script callback. Where are you calling the #ajaxReplaceWith: method? Is this in the #removeToken: method? And how are you constructing the aJSQuery?
My guess is that you hit a problem that is identical to the one mentioned in the 'important' box here: http://book.seaside.st/book/web-20/scriptaculous/ajax/updating
If you are generating another ajax callback, the renderContext (and thus actionUrl, etc...) are wrong.
On 12 Aug 2010, at 01:17, Tim Mackinnon wrote:
> So I was making great progress until I descided to render remove buttons 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: (html jQuery ajax script: [:s| self removeToken: i]); value: 'Remove' ] ] ] ] ] ]
>
> And I get something in my page like this:
>
> <button class="submit" type="submit" onclick="$.ajax({"dataType":"script","url":"/elephant","data":["_s=6EHJpgKqpOIhEcqM","_k=ICZ-_7Df8kBvKt2F","3"].join("&")})">Remove</button>
>
> When
> I 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" type="submit" onclick="$.ajax({"dataType":"script","url":"/","data":"1"})">Remove</button>
>
> I
> think I picked up the above fragment from some mal message answer by Lukas - and it was working well, but notice how the url parameter is wrong - its not /element with the k and s paramters???
>
> Is this because render: is not rendering in the context of a child component? And is there some other way of re-rendering my component by an ajax call? I think Julian had an example in the comet thread - maybe I can get that to work?
>
> Any help greatly appreciated.
>
> Tim
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
More information about the seaside
mailing list