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

Tree scroll position didn't clear when setting new model and then invalidate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.8, 7.0.6
    • 6.5.7, 7.0.5
    • Components
    • Security Level: Jimmy
    • ZK 7.0.7
    • None

      Reproduce steps:
      1. Scroll to most bottom and click on item98 to select it.
      2. Click "Switch to smaller model" button. The scrollbar position is incorrectly.
      Reproducible sample:

      <zk>
          <window border="normal" title="hello">
      <zscript><![CDATA[
      DefaultTreeNode root = new DefaultTreeNode("root", new ArrayList());
      for (int i = 0; i < 99; i++) {
          root.add(new DefaultTreeNode("item " + i));
      }
      DefaultTreeModel model = new DefaultTreeModel(root);
      void invalidate() {
          root.getChildren().clear();
          root.getChildren().add(new DefaultTreeNode("New item"));
          tree.setModel(new DefaultTreeModel(root));
          tree.invalidate();
      }
      ]]></zscript>
              <button id="btn" label="Switch to smaller model" onClick="invalidate()" />
              <vlayout height="100px" width="200px">
                  <tree id="tree" model="${model}" vflex="1">
                      <treecols>
                          <treecol label="Treecol" />
                      </treecols>
                  </tree>
              </vlayout>
          </window>
      </zk>
      

            DevChu DevChu
            vincentjian vincentjian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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