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

combobox with listsubmodel + incorrect selectedObject in onSelect event

XMLWordPrintable

    • None

      Steps to Reproduce

      <zk>
          <zscript><![CDATA[
              List locales = new ArrayList();
              for(Locale loc : Locale.getAvailableLocales()) {
                  locales.add(loc.getDisplayName().toLowerCase());
              }
              SimpleListModel model = new SimpleListModel(locales);
          ]]></zscript>
          <combobox model="${model}" autodrop="true"
                    onSelect='
                      Clients.log("SelectedItem   : " + event.getSelectedItems().iterator().next().getValue());
                      Clients.log("SelectedObject : " + event.getSelectedObjects().iterator().next());
                    '>
          </combobox>
      </zk>
      

      1) type a few characters to drill down the choices (e.g. 'eng')
      2) select a comboitem, or use UP DOWN keys to browse the items
      3) watch the logs

      Current Result

      the value in SelectEvent.getSelectedObjects() doesn't match the selected item

      SelectedItem   : english (niue)
      SelectedObject : 
      SelectedItem   : english (montserrat)
      SelectedObject : norwegian nynorsk
      SelectedItem   : english (guernsey)
      SelectedObject : arabic (jordan)
      SelectedItem   : english (jamaica)
      SelectedObject : bulgarian
      SelectedItem   : english (zambia)
      SelectedObject : kabuverdianu
      SelectedItem   : english (malta)
      SelectedObject : low german
      SelectedItem   : english (liberia)
      SelectedObject : zulu
      SelectedItem   : english (ghana)
      SelectedObject : amharic (ethiopia)
      SelectedItem   : english (israel)
      SelectedObject : french (algeria)
      SelectedItem   : english (palau)
      SelectedObject : tigrinya (ethiopia)
      SelectedItem   : english (st. vincent & grenadines)
      SelectedObject : tibetan (china)
      

      Expected Result

      selected item and object should be in sync

      Debug Information

      the selected objects seems to be determined by the current selected index from the drilled down list by listsubmodel -> then looked up in the original listmodel

      Workaround

      don't use selectedObject, use event.getSelectedItems() or model.getSelection()

            jumperchen jumperchen
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: