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

Combobox model setSelection does not update the textbox

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Normal
    • 8.0.1
    • None
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.0.1 S1

    Description

      on 8.0.1.FL.20151111 and later:
      ListmodelList.setSelection, or addToSelection does not update the combobox main textbox.

      This is likely related to following commit:
      https://github.com/zkoss/zk/commit/59a6252be31615cdff192a3357249ccf1955cb61#diff-e1c31ce5bd0ed2c14db649d67bee47f7L114
      on http://tracker.zkoss.org/browse/ZK-2937

      See following example:
      click on the button to select 1st Item.
      Expected : item is selected and item value is set in the textbox.
      Result : item is selected (in the model) but value is not set in the textbox.

      <zk>
      	<zscript><![CDATA[
      		ListModelList myModel = new ListModelList();
      		myModel.add("Value1");
      		myModel.add("Value2");
      		myModel.add("Value3");
      		]]>
      	</zscript>
          <combobox id="cmb" model="${myModel}"/>
          <button label="set selection on 1st item" onClick='cmb.model.clearSelection();cmb.model.addToSelection(cmb.model.get(0))'/>
      </zk>
      
      

      Additional data:

      In combobox:setSelectedItem(Comboitem item) (called when model is updated)
      setValueDirectly(item.getLabel()); set the value of the component, but does not trigger update on its own.
      the smartUpdate("selectedItemUuid_", item.getUuid()); instruction cause the widget to correctly update its selected item property, but not its value.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: