[Seaside] Differences in calling render: from ajax?
Tim Mackinnon
tamackinnon at gmail.com
Wed Aug 11 23:17:29 UTC 2010
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
More information about the seaside
mailing list