Well, the component doesn`t work like this.
The suggestedItemsMethod takes a String which was the input of the
user before the ajax-request. With the help of this string the lookup
in the db is performed and the result as
a list of strings is returned. Which exactly matches the pop-up.
If you want to get a behaviour like it can be found in menues with the
value/label approach,
you have to define a "itemLabelMethod". The suggestedItemsMethod
should then return a list of objects. The label is extracted through
the itemLabelMethod (which gets an object from the list) and the value
through a given converter.
Hope this helps,
cheers,
Gerald
On 10/30/06, Martin Grotzke <[EMAIL PROTECTED]> wrote:
On Mon, 2006-10-30 at 13:50 +0100, Gerald Müllan wrote:
> Hi,
>
> forget the binding stuff. It is not needed. The docu on this component
> is outdated.
Thanx for this hint :)
>
> All you need to do to get it work in the simplest mode is just
> implement the suggestedItemsMethod.
But probably i can use the valueChangeListener to fetch the items
that are returned by suggestedItemsMethod?
I just tried the component with the following sniplet:
<s:inputSuggestAjax id="departures"
suggestedItemsMethod="#{createReservationController.departure.suggest.items}"
value="#{createReservationController.departure.suggest.userInput}"
valueChangeListener="#{createReservationController.departure.suggest.userInputChanged}"
maxSuggestedItems="10" size="10"
tabindex="2" />
and the following on the server side:
public void userInputChanged( ValueChangeEvent event ) {
LOG.debug( "Invoked" );
// performs a lookup in the backend
// and updates the suggested items:
suggestItems( true );
}
public Collection<SelectItem> getItems() {
return _items;
}
public String getUserInput() {
return _userInput;
}
public void setUserInput( String input ) {
_userInput = input;
}
Unfortunately, the java code is never called, even the
createReservationController.getDeparture is not called....
Can you tell me what is wrong with this?
We are using the nightly snapshot (today) of myfaces-api/impl, tomahawk
and the sandbox.
Thanx && cheers,
Martin
>
> Sorry for the confusion on this.
>
> cheers,
>
> Gerald
>
> On 10/30/06, Martin Grotzke <[EMAIL PROTECTED]> wrote:
> > Hey all,
> >
> > the documentation for inputSuggestAjax
> > (http://myfaces.apache.org/sandbox/inputSuggestAjax.html) says that
> > the binding attribute "is needed because the control object does all the
> > needed data transformation between the Ajax control and the
> > backend/frontend"...
> >
> > Has someone an example how to implement the binding on the server side?
> >
> > Thanx a lot,
> > cheers,
> > Martin
> >
> > --
> >
> >
> >
>
>
--
Martin Grotzke
http://www.javakaffee.de/blog/
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces