struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso" <musa...@gmail.com>
Subject Re: s.autocompleter with JSON Plugin
Date Sat, 17 Mar 2007 14:21:42 GMT
This was an issue in 2.0.6 and it is fixed on 2.0.7:

https://issues.apache.org/struts/browse/WW-1659

As Dave mentioned in 2.0.6 the autocompleter was expecting an array of
arrays. Now the autocompleter will use the following logic to determine how
to load the data:

1. If the response is an array, use it
2. If the response is an object, and has a field  that matches the
"dataFieldName" attribute in the autocompleter, use it.
3. If the response is an object, and has a field that starts with the "name"
of the autcompleter use it
4. If a field of type array is found, use it

so the following cases will work:

public class MyAction {
   private String[][] states;  //data here
}

<s:autocompleter dataFieldName="states" ..> // #2
<s:autocompleter name="state" ..>  //#3
<s:autocompleter ...> //#4

regards
musachy

On 3/17/07, Dave Newton <newton.dave@yahoo.com> wrote:
>
> --- Rohit Dewan <dewanr@gmail.com> wrote:
> > However, the autocompleter is blank after load.
> >
> > Has anyone had success using the JSON plugin with
> > the autocompleter?
>
> I'm getting a JavaScript error:
>
> [Exception... "'Error: TypeError:
> this.data[x][0].toLowerCase is not a function' when
> calling method: [nsIDOMEventListener::handleEvent]"
> nsresult: "0x8057001c
> (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location:
> "<unknown>" data: no]
>
> (I'm also doing this in JSP w/o the workaround you're
> using.)
>
> The <s:autocompleter.../> tag docs says that input
> data must be in the format
>
> [["foo":"bar"],
> ["baz":"quux"]]
>
> though, so... I don't know if it will work with the
> default JSON plugin, and if true that would also imply
> that you could only load one autocompleter per JSON
> Action rather than lumping a bunch together (if you
> wanted to) and the tag would grab the appropriate data
> by the tag's "name" attribute.
>
> d.
>
>
>
>
>
> ____________________________________________________________________________________
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message