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

tree with paging is broken in zk8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • None
    • 8.0.0, 8.0.1, 8.0.1.1
    • None
    • zk 8.0.1.1, 8.0.1 and 8.0.0 from maven
      java 1.8
      windows 7
      chrome v52

      In zk8 only first page of a tree with model and paging is rendered fine.
      Starting from page 2 content some elements have no content.

      Example:

      tst.zul
      <zk>
          <window apply="MyComposer" border="normal" title="TestWindow" mode="modal">
              <tree id="tstTree" mold="paging" pageSize="5">
                  <template name="model">
                      <treeitem label="${each}" />
                  </template>
              </tree>
          </window>
      </zk>
      
      MyComposer.java
      import java.util.Arrays;
      
      import org.zkoss.zk.ui.Component;
      import org.zkoss.zk.ui.select.annotation.Wire;
      import org.zkoss.zk.ui.util.GenericForwardComposer;
      import org.zkoss.zul.DefaultTreeModel;
      import org.zkoss.zul.DefaultTreeNode;
      import org.zkoss.zul.Tree;
      
      public class MyComposer extends GenericForwardComposer<Component> {
      
          @Wire
          private Tree tstTree;
      
          @Override
          public void doAfterCompose(Component comp) throws Exception {
              super.doAfterCompose(comp);
              tstTree.setModel(createNewModel());
          }
      
          private static DefaultTreeModel<String> createNewModel() {
              return new DefaultTreeModel<>(
                  node("root",
                      node("item-0",
                          node("item-0-0"),
                          node("item-0-1"),
                          node("item-0-2", node("item-0-2-0"), node("item-0-2-1")),
                          node("item-0-3", node("item-0-3-0"), node("item-0-3-1"), node("item-0-3-2")),
                          node("item-0-4"),
                          node("item-0-5"),
                          node("item-0-6", node("item-0-6-0"), node("item-0-6-1")),
                          node("item-0-7")
                      )
                  )
              );
          }
      
          @SafeVarargs
          private static DefaultTreeNode<String> node(String name, DefaultTreeNode<String>... children) {
              return (children.length == 0) ? new DefaultTreeNode<>(name) : new DefaultTreeNode<>(name, Arrays.asList(children));
          }
      }
      

      –ěn my computer and on computer of my collegue:
      After page loaded everything is fine: only item-0 visible

      After opening item-0 and item-0-2 everything fine: paging controls and 4 child nodes now visible on page 1


      But on the second page only item-0-3 is rendered. Other nodes have no content.

      In zk7 this example is working fine.

      As far as I can tell the problem probably relates to:
      1. new mechanism in zk8 of rendering node content only when the node become visible (for example when parent node is opened).
      2. not triggering the mechanism on page switch event.
      But this is just my assumption (based on content of Network tab of chrome).
      There were client requests to server "onRender" and "onPaging". And it looks like responses for the the requests should contain data to render content of treeitems. But i cant figure out where exactly is the problem.

        1. 1.png
          1.png
          84 kB
        2. 2.png
          2.png
          87 kB
        3. 3.png
          3.png
          86 kB
        4. 4.png
          4.png
          84 kB

            Unassigned Unassigned
            qqtt qqtt
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: