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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 9.5.0.2
    • Fix Version/s: None
    • Component/s: Components
    • Environment:

      Firefox 86 on Linux Mint 20.1, probably any browser/platform

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            chemFelix chemFelix
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

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