On Jan 14, 2009, at 12:11 AM, Chuck Hill wrote:


On Jan 12, 2009, at 7:24 AM, John Ours wrote:

Hi All,

Quick question about the Ajax Slider component in Wonder. What is the rationale behind the OnChangeServer binding? The behavior seems to be that if the binding is set - regardless of its value - an ajax post occurs to set the value. A quick peek at the source confirms that's what's going on...and the value of the binding is being ignored. Was this the intended behavior and I'm missing something? Or would this binding be better expressed as a boolean?


The binding is supposed to return a JavaScript snippet to be run in the browser after the slider changes.



Thanks Chuck. How does OnChangeServer differ from OnChange then? In the SliderExample from the Wonder project, they use OnChange and OnSlide for the client javascript, like this:

AjaxSlider1: AjaxSlider {
        orientation = "horizontal";
        value = 10;
        minimum = 0;
        maximum = 10;
        onSlide = "function(v) {$('value').innerHTML = v}";
        onChange = "function(v) {$('value').innerHTML = v}";
}

In particular I'm curious about this piece of code (and a similar one for onSlideServer) from AjaxSlider.java:

        if(hasBinding("onChangeServer")) {
                String parent = (String) valueForBinding("onChange");
options.setObjectForKey("function(v) {new Ajax.Request('"+ AjaxUtils.ajaxComponentActionUrl(context()) +"', {parameters: '"+context().elementID()+"=' + v + '&ajaxSlideTrigger=onChange'})" +(parent != null ? "; var parentFunction = " + parent + "; parentFunction(v);" : "")
                                +"}", "onChange");
        } else {
new AjaxOption("onChange", AjaxOption.SCRIPT).addToDictionary(this, options);
        }




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to