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

Scroll position is reset to top if resize column of a grid with rod

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.0.13, 6.5.4
    • Fix Version/s: 5.0.14, 6.5.5, 7.0.1
    • Component/s: General
    • Security Level: Jimmy
    • Labels:

      Description

      1. Resize browser window until the vertical bar appears
      2. Scroll down
      3. Resize any grid column

      The scroll bar would move to the very top.

      test.zul
      <zk>
          <zscript><![CDATA[
          public class MyRowRenderer implements RowRenderer {
              public void render(Row row, Object obj, int index) {
                  Object[] data = (Object[]) obj;
                  row.appendChild(new Label(data[0].toString()));
                  row.appendChild(new Label(data[1].toString()));
                  row.appendChild(new Label(data[2].toString()));
              }
          }
          
          ListModelList model = new ListModelList();
          for (int i = 0; i < 30; i++)
              model.add(new Object[] { "Row"+i, 0.00, 0.00 });
          RowRenderer renderer = new MyRowRenderer();
          ]]></zscript>
          <window title="ZK ${desktop.webApp.version}" width="80%" height="100%" 
              closable="true" sizable="true" maximizable="true" border="normal">
              
              <custom-attributes org.zkoss.zul.grid.rod="true" />
              <grid id="grid" vflex="true" mold="paging"
                  model="${model}" rowRenderer="${renderer}">
                  <columns sizable="true">
                      <column></column>
                      <column>Col1</column>
                      <column>Col2</column>
                  </columns>
              </grid>
          </window>
      </zk>
      

      Workaround is to apply the following.

      workaround
      <script>
      zk.afterLoad('zul.mesh', function() {
          var _mesh = {};
          zk.override(zul.mesh.MeshWidget.prototype, _mesh, {
              onSize: function() {
                  this._currentTop = this.ebody.scrollTop;
                  _mesh.onSize.apply(this, arguments);
              }
          });
      });
      </script>
      

        Attachments

          Activity

            People

            Assignee:
            noahhuang noahhuang
            Reporter:
            neillee neillee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: