I discovered the magic :-)

Also, I was a bit wrong in my previous message. When I said I could change the binding for "onChangeServer" to anything and it would still work, that is not true. I must have not saved my wod file but thought I did and got confused. You must use "tableBodyUpdate()" for the binding, nothing else will work.

Here's how the magic works:

1) Create an update container with a specific CSS ID - let's say "tableBody"

2) There is some clever processing in the javascript object of an ajax update container that creates a javascript function on the fly. The name is the CSS ID of the updateContainer with the word "Update" appended. So in this case it is, "tableBodyUpdate"

3) Anywhere in your java code, at any time, you can invoke "tableBodyUpdate()" and it will refresh the ajax update container.

Here's the line in wonder.js that does the magic of creating the special javascript function:

        register : function(id, options) {
                if (!options) {
                        options = {};
                eval(id + "Update = function() { AjaxUpdateContainer.update(id, options) }");

This is really cool and totally brilliant. I wish I understood this long ago.

-- Aaron

wonder-disc-bounces@lists.sourceforge.net wrote on 26-12-2007 03:40:45 PM:

> Hello,
> It's a bit of a mystery to me how the AjaxSlider works on the WOnder
> demo component "UpdateDisplayGroupExample".
> When I drag the scroll bar and let go, it does update the display of
> items on the page, but how? When I look at the bindings for
> AjaxSlider I see that onChangeServer = "tableBodyUpdate()". The
> curious thing is that I don't see a javascript function named
> "tableBodyUpdate" defined anywhere, but if I delete this binding,
> the scroller no longer works! :-) It's magic :-) Even cooler, if I
> replace "tableBodyUpdate()" with
> "thereIsSomethingIKnowThatYouDoNot()" it works again :-)
> Upon further inspection into AjaxSlider.java, I see that it simply
> checks to see if something was bound to "onChangeServer" and then
> branches off into some logic but never uses the value that was
> bound. Instead, it uses the value for "onChange" but wraps it in
> some logic that I can't quite grok.
> So it really seems that "onChangeServer" should be a boolean binding
> that branches off when it is "true".
> Still, for the life of me, I don't understand how it knows what part
> of the screen to redraw. It doesn't have an updateContainerID or
> nothing... It's very curious. Please enlighten me when you have a chance :-)
> Thanks in advance,
> -- Aaron