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

Listbox.getVisibleItemCount() does not reset its value after Listbox.setModel()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.0
    • 8.0.1
    • Components
    • Windows 10, Microsoft IE 11, Microsoft Edge, Firefox v54, Eclipse Neon3 (4.6.3), jdk 7, tomcat 7

      I created a java procedure in order to update listbox content using a model.
      This is the code, very simple:

      public void listboxRenderer((List<MyData>) myList) {
          myListbox.setItemRenderer(listitemRenderer);
          ListModelList<MyData> listModelList = new ListModelList<MyData>((List<MyData>) myList);
          myListbox.setModel(listModelList);
          System.out.println("myListboxSize : " + myListbox.getItemCount());
          System.out.println("visibleItemCount : " + myListbox.getVisibleItemCount());
          for (Listitem item : myListbox.getItems()) {
              System.out.println(item + " - " + item.isVisible());
          }
      }
      

      This is the output:

      -----------------------
      availabilityListboxSize : 1
      visibleItemCount : 1
      <Listitem tYEQc4> - true
      -----------------------
      availabilityListboxSize : 1
      visibleItemCount : 2
      <Listitem tYEQz4> - true
      -----------------------
      availabilityListboxSize : 8
      visibleItemCount : 10
      <Listitem tYEQ16> - true
      <Listitem tYEQ36> - true
      <Listitem tYEQ56> - true
      <Listitem tYEQ76> - true
      <Listitem tYEQ96> - true
      <Listitem tYEQb6> - true
      <Listitem tYEQd6> - true
      <Listitem tYEQf6> - true
      -----------------------

      It seems that after applying the model, visibleItemCount increases its value.

            Leon03 Leon03
            sboscolo sboscolo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified