Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-5248

combobox autocomplete wrong behaviour

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 9.0.1, 9.6.2
    • Fix Version/s: None
    • Component/s: Components
    • Security Level: Jimmy
    • Labels:
    • Environment:
      • OpenJDK 1.8.0_345
      • Tomcat 9.0.62
      • ZK 9.0.1 and later

      Description

      Steps to Reproduce

      Given following view model and zul

      import java.util.Arrays;
      
      import org.zkoss.bind.annotation.Init;
      import org.zkoss.zul.ListModel;
      import org.zkoss.zul.SimpleListModel;
      
      public class TestViewModel {
      	private ListModel<String> model;
      
      	public ListModel<String> getModel() {
      		return model;
      	}
      
      	@Init
      	public void init() {
      		model = new SimpleListModel<String>(Arrays.asList("a1", "a2", "a3", "a4", "a5", "b1", "b2"));
      	}
      }
      
      <vlayout viewModel="@id('vm') @init('TestViewModel')">
      	<combobox autocomplete="true" width="18px" model="@load(vm.model)" autodrop="true" />
      </vlayout>
      
      1. type "a"
      2. click item "a5"
      3. type "a"
      4. click item "a4"

      Current Result

      First item, "a1", is selected

      Expected Result

      Item "a4" is selected. Versions up to and including 9.0.0.1 work as expected.

      Debug info

      1st
      1. doKeyUp > _typeahead
      valueEnter=a, inp.value=a (no comboitems rendered)
      2. setRepos > _typeahead
      valueEnter=a, inp.value=a1

      2nd

      1. doKeyUp > _typeahead
      valueEnter=a, inp.value=a1 (comboitem rendered)
      2. setRepos > _typeahead
      valueEnter=a1, inp.value=a1
      3. onblur
      onChanging fired

      • the 2nd time input, combobox fills 'a1' very fast because comboitem are rendered already.
      • when clicking an item, onBlur fires onChanging, then cause removing comboitems immediately, cause not able to click a comboitem.

      Workaround

        Attachments

        1. zk-5248.zul
          0.2 kB
        2. zk-5248-3.js
          1 kB
        3. ZK5248VM.java
          0.3 kB

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            benedetti benedetti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: