On Wed, Aug 1, 2012 at 4:08 AM, Martin Grigorov <[email protected]> wrote: > Hey Sven, > > On Wed, Aug 1, 2012 at 2:01 PM, Sven Meier <[email protected]> wrote: >>> DropDown has a clear pattern: >>> the renderer is used only for >>> rendering purpose >> >> BTW this is not correct: all choice components use their renderer for >> rendering AND input, AutoCompleteTextField uses its renderer for rendering >> only. > > Do you know why this is the case ?
because autocomplete is *not* a choice component. you can pick a value that is not in the choices collection. that is why i created select2. we had a bunch of autocompletes we were using to pick from existing choices and it led to all kinds of headaches because it is not what autocomplete is meant for. -igor > Is it possible to improve ACTF to be smarter ? > >> >> Sven >> >> Sven Meier <[email protected]> schrieb: >> >>>You have to overwrite AutoCompleteTextfield#getConverter() and provide a >>>converter for your object. >>> >>>You can use #getChoices() to find the correct object for the new input. >>> >>>Sven >>> >>>Daniele Dellafiore <[email protected]> schrieb: >>> >>>>Hi. >>>> >>>>I'm sure I'm talking about something that has already been discussed >>>>here and on stackoverflow a lot, but still I haven't found a solution. >>>> >>>>I do not understand how AutocompleteTextField works when dealing with >>>>list of objects that are not just strings. Other wicket components >>>>like DropDown has a clear pattern: the renderer is used only for >>>>rendering purpose, there's a model to store selection and a model to >>>>store choices options. >>>> >>>>Still, I can't figure out how to do the very same thing with >>>>AutocompleteTextField. >>>> >>>>The best I can get is: >>>> TextField codeField = new >>>> AutoCompleteTextField<JSONObject>("code", >>>>model, JSONObject.class, renderer, >>>> new AutoCompleteSettings()); >>>> >>>> >>>>I'm using an AbstractAutoCompleteTextRenderer and a PropertyModel >>>>binded to a JSONObject variable. >>>>It all works but when I submit the form, it says me that the selected >>>>string is not a valid JSONObject, so he cannot attach it to the field. >>>> >>>>the ITerator returned by AutocompleteTextField.getChoices(String >>>>input) is an Iterator of JSONObject. >>>>I expect that when I submit, the setObject receives the selected >>>>JSONObject, not the String I do render using a specific Renderer. >>>> >>>>How can that be done? >>>> >>>>Thanks anyone for help. >>>> >>>>-- >>>>Daniele Dell >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
