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

select all throws an exception if the model is empty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 10.0.0
    • 9.6.4
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      1. click the "selectAll" checkbox in the header of a Listbox

      Current Result

      java.lang.IndexOutOfBoundsException: Index: 1
      at java.base/java.util.AbstractSequentialList.get(AbstractSequentialList.java:90)
      at org.zkoss.zul.Listbox$1.get(Listbox.java:391)
      at org.zkoss.zul.Listbox$1.get(Listbox.java:385)
      at org.zkoss.zul.Listbox.service(Listbox.java:3729)
      at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:861)

      Expected Result

      no error

      Debug info

      • 9.6.3 doesn't have this bug
      • caused by the fix of ZK-2658

      Workarounds

      Two options, apply either but not both

      Workaround #1

      Use JS to prevent select all event if the content is empty:

      zk-5483.js

      Workaround #2

      Java side Listbox override
      Listbox.java

        1. Listbox.java
          122 kB
          hawk
        2. zk-5483.js
          0.6 kB
          hawk
        3. zk-5483.zul
          0.9 kB
          hawk

            jamson jamson
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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