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

When binding to Combobox.selectedItem, value gets nulled onBlur after entering matching text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Normal Normal
    • None
    • 9.5.0.2
    • Components
    • Firefox 86 on Linux Mint 20.1, probably any browser/platform

      Steps to Reproduce

      <combobox value="@bind(vm.someString)" selectedItem="@save(vm.someObject)" autodrop="true" model=".."/>

      Enter text that matches exactly the label of an item. onChange fires multiple times,

      1. vm.setSomeObject(..) gets called with correct value of (auto-selected) item
      2. vm.setSomeString(..) gets called with correct text from textbox
      3. vm.setSomeObject(..) gets called again with null value, which is wrong. Reason is that in org.zkoss.bind.converter.sys.ComboboxSelectedItemConverter:87, the selection is empty as it is not synced correctly/cleared again/whatever

      Current Result

      vm.setSomeObject(..) gets called with null value even though it was previously called with correct value

      Expected Result

      vm.setSomeObject(..) should be called only once with correct value as selected (implicitly) by entering the label text. Note: when clicking the comboitem, everything is fine

      Debug Information

       

      Workaround

      Add onChange listener with prio=100 and set matching comboitem via code (and selection in model accordingly), very bad (yet working) solution.

            DevChu DevChu
            chemFelix chemFelix
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified