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

Clicking on combobox button does not select listitem when nonselectableTags=""

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 7.0.5
    • 7.0.3
    • None
    • Security Level: Jimmy

      Problem Description:

      Setting nonselectableTags to empty string should allow listitem to be selected no matter which embedded HTML tag is clicked. However, this method worked for <textbox/> but failed for <combobox/>.

      Steps to reproduce:

      1. Click on textbox
      2. Check system console
      -> a listitem is selected
      3. Click on combobox button
      4. Check system console
      -> nothing happened

      <zk xmlns:w="client">
          <zscript><![CDATA[
          ListModelList model = new ListModelList();
          model.add("1");
          model.add("2");
          model.add("3");
          ]]></zscript>
          <listbox model="${model}" nonselectableTags="" onSelect="System.out.println(self.selectedItem)" width="100%">
              <listhead>
                  <listheader label="Combobox" width="100px" />
                  <listheader label="Textbox"  />
              </listhead>
              <template name="model" var="record">
                  <listitem value="${record}">
                      <listcell>
                          <combobox model="${model}" width="100%">
                              <template name="model" var="option">
                                  <comboitem label="${option}" />
                              </template>
                          </combobox>
                      </listcell>
                      <listcell>
                          <textbox />
                      </listcell>
                  </listitem>
              </template>
          </listbox>
      </zk>
      

      Workaround:

      Apply the following code to combobox

      <attribute w:name="onOpen"><![CDATA[
      if (!event.open) return;
      var listitem = this.parent.parent,
          listbox = listitem.getListbox();
      // select listitem on client-side
      listbox.selectItem(listitem);
      // notify server about selection change
      listbox.fire('onSelect', { items: [ listitem ], reference: listitem, clearFirst: true, selectAll: false});
      ]]></attribute>
      

            jumperchen jumperchen
            neillee neillee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: