Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-488

Allow more complex behaviour for AutoCompleter component

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.4-M3
    • wicket-extensions
    • None
    • wicket-1.x snapshot

    Description

      It would be nice to be able to modify the default behaviour of the ajax autocompleter component upon selection of an list item. this would make it a even more useful component and exceed it's capabilities beyond simple text replacement.

      current behaviour:

          1. snip : wicket-autocomplete.js line 93-97 ###
            case KEY_ENTER:
            if(selected>-1){
            obj.value=getSelectedValue();
            hideAutoComplete();
            hidingAutocomplete=1;
          2. eof snip ###

      Instead of having obj.value= being filled by the current text value it would be nice to have the option of specifying a js function callback to e.g. post back the selected value to the server. This way you could implement more complex behaviour, for example select a company address from a list and, on selecting it, send back the address id to the server which then would fill out street, house number, zip code and city.

      pseudo code:
      if selected
      if callback
      callback(value)
      else
      obj.value = current value
      end
      .....

      probably the right place for such a on-select contribution would be the autocomplete renderer.

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            pete Peter Ertl
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: