[Seaside] Differences in calling render: from ajax?
John McKeon
p3anoman at gmail.com
Sun Aug 15 15:55:42 UTC 2010
Hi Tim,
Perhaps you have gone a bit astray...first, I don't see where you render the
myID div, and jQuery of course needs a div with an id in what you are trying
to do.
Here is what I suggest, along the lines of the CTChat example.
On Wed, Aug 11, 2010 at 7:17 PM, Tim Mackinnon <tamackinnon at gmail.com>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:
>
>
Try breaking this method up so that the rendering of the tokenWaiters is in
its own method.
> renderContentOn: html
> (html div)
>
id: #waiters;
with: [ self renderTokenWaitersOn:html ]
renderTokenWaitersOn: html
> 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 ]
>
Then instead of r render: self put self renderTokenWaitersOn: html and tell
jQuery to replace the #waiters id added above.
I could be completely mistaken of course. But that is what I would try.
John
>
> 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
>
--
http://john-mckeon.us/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100815/60c423f0/attachment.htm
More information about the seaside
mailing list