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

Combobox item selection rely items label string

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.5.4, 7.0.5
    • Fix Version/s: 8.0.0
    • Component/s: Components
    • Security Level: Jimmy
    • Labels:
    • gh.sprint.customfield.default.name:
      ZK 8.0.1

      Description

      Sometimes is needed to add multiple items with same label, but there can be different icon and/or description. Current version has bug at server and client.

      Bugs, when combobox has multiple items which has identical labels:
      -client: change is not triggered when select another item with same label
      -server: combobox's selected item is find by string, not by item. Selected item is first Comboitem, which label match.

      Combobox need rely on items, not strings, when selecting item(s).

        Issue Links

          Activity

          Hide
          nikomo nikomo added a comment - - edited

          I did really ugly hack to resolve this. Hack's complexity is O^(n+1) so it is not ideal, but works.

          /**
           * Combo can't handle multiple identical labels by bug: {@link http://tracker.zkoss.org/browse/ZK-1987}. 
           * FIXME Remove when bug is repaired.
           * @param label 
           * @return non unique label
           */
          public String checkLabelUnique(String label) {
          	for (Entry<Type, ComboItem> e : this.values.entrySet()) {
          		ComboItem i = e.getValue();
          		if (i.getLabel() == null)
          			continue;
          		if (i.getLabel().equals(label))
          			return this.checkLabelUnique(label + " ");
          	}
          	return label;
          }
          
          Show
          nikomo nikomo added a comment - - edited I did really ugly hack to resolve this. Hack's complexity is O^(n+1) so it is not ideal, but works. /** * Combo can't handle multiple identical labels by bug: {@link http: //tracker.zkoss.org/browse/ZK-1987}. * FIXME Remove when bug is repaired. * @param label * @ return non unique label */ public String checkLabelUnique( String label) { for (Entry<Type, ComboItem> e : this .values.entrySet()) { ComboItem i = e.getValue(); if (i.getLabel() == null ) continue ; if (i.getLabel().equals(label)) return this .checkLabelUnique(label + " " ); } return label; }
          Hide
          DevChu DevChu added a comment -

          The reason of this bug is that combobox provides auto-complete when typing, so the implementation is String type.
          To handle this situation (using same label), we need to change the implementation.
          We will fix it in ZK 8.

          Show
          DevChu DevChu added a comment - The reason of this bug is that combobox provides auto-complete when typing, so the implementation is String type. To handle this situation (using same label), we need to change the implementation. We will fix it in ZK 8.
          Hide
          christopherszu christopherszu added a comment - - edited

          fixed since 2015/08/27

          Show
          christopherszu christopherszu added a comment - - edited fixed since 2015/08/27

            People

            • Assignee:
              DevChu DevChu
              Reporter:
              nikomo nikomo
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 6 hours
                1d 6h

                  Agile