[ 
https://issues.apache.org/jira/browse/TAPESTRY-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Wood updated TAPESTRY-2234:
----------------------------------

    Attachment: TAPESTRY-2234-tapestry-project.patch

This patch offers a solution to the issue. It makes only 2 small changes to 
JSONObject to accomplish this.

1. Add JSONString to the list of allowed objects in the config.

2. When doing toString (and subsequent valueToString), if the object is a 
JSONString, don't quote it's toJSONString method.
    - given it was impossible to execute this piece of code prior to making 
JSONString an allowable object, I don't think this can hurt anything.

Now you can extend autocomplete and override configure properly:

    protected void configure(JSONObject config) {
        config.put("updateElement", new JSONString() {
            public String toJSONString() {
                return "hello";
            }
        });
    }

This will call the hello method in your javascript when you choose something 
from the autocomplete dropdown:

function hello() {
    alert('hello');
}

Of course, in the case of autocomplete, this allows you to substitute your 
methods for many of the configurable options in the prototype autocomplete, 
something which is impossible right now.



> Autocomplete / JSONObject config surrounds parameter with double qoute
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-2234
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2234
>             Project: Tapestry
>          Issue Type: Bug
>          Components: XHR/dhtml/Ajax
>            Reporter: Sven Homburg
>             Fix For: 5.0
>
>         Attachments: TAPESTRY-2234-tapestry-project.patch
>
>
> the JSONObject config in mixin Autocomplete surrounds parameters with double 
> qoute.
> so  Ajax.Autocompleter dont know how to interpreting the callbacks like 
> "afterUpdateElement"
> and throws an exception "function not found".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to