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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.0.1
    • Fix Version/s: 8.6.0
    • Component/s: Components
    • Labels:
    • Environment:

      Windows 10, Microsoft IE 11, Microsoft Edge, Firefox v54, Eclipse Neon3 (4.6.3), jdk 7, tomcat 7

      Description

      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.

      1. zk3735.zul
        0.6 kB
        rudyhuang
      2. ZK3735TestComposer.java
        2 kB
        rudyhuang

        Activity

        Hide
        Leon03 Leon03 added a comment -

        The _visibleItemCount of listbox did't reset before syncModel.

        Show
        Leon03 Leon03 added a comment - The _visibleItemCount of listbox did't reset before syncModel.
        Hide
        Anonymous added a comment -

        Fixed since 2018/08/23

        Show
        Anonymous added a comment - Fixed since 2018/08/23

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

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