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

Grid / Listbox ROD JS errors

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 7.0.1
    • Fix Version/s: 7.0.2
    • Component/s: Components
    • Security Level: Jimmy
    • Labels:

      Description

      a user reported an unfortunately not reproducible case where he is getting the following JS Errors (happened with native scrollbar enabled)

      SCRIPT5007: Für die Eigenschaft "scrollTop" kann kein Wert festgelegt werden: Das Objekt ist Null oder undefiniert
      zk.wpd, Zeile 27987 Zeichen 4

      the following JS code added to a page fixed the related issues:
      (Added checks before trying to access "this.ebody.scrollTop = 0;")

      <script>
      	<![CDATA
      	zk.afterLoad('zkmax, zul.sel', function() {
      		
      		//console.log("override listbox");
      		
              var _listbox = {};
              zk.override(zul.sel.Listbox.prototype, _listbox, {
                  setResetDataLoader: function () {
                      this._justScrollPads = this._currentTop = this._currentLeft = this._topPad = this._lasttop = 0;
                      this.refreshBar_(false, true);
                      
                      //console.log("setResetDataLoader listbox called", this.ebody)
                      
                      if (this._nativebar && this.ebody) {
                          this.ebody.scrollTop = 0;
                      }
                  }       
              });
          });
      
      	zk.afterLoad('zkmax, zul.grid', function() {
      		
      		//console.log("override grid");
      		
              var _grid = {};
              zk.override(zul.grid.Grid.prototype, _grid, {
      			setResetDataLoader: function () {
      				this._currentTop = this._currentLeft = this._topPad = this._lasttop = 0;
      				this.refreshBar_(false, true);
      
      				//console.log("setResetDataLoader grid called", this.ebody)
      				
      				if (this._nativebar && this.ebody) {
      					this.ebody.scrollTop = 0;
      				}
                  }       
              });
          });
      	]]>
      	</script>
      

      Even if the reported issue was about listbox, the same might happen with Grid... as the code looks very similar.

      affected files are in zkmax.jar
      /web/js/zkmax/grid-rod.js:
      /web/js/zkmax/listbox-rod.js:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jumperchen jumperchen
                Reporter:
                cor3000 cor3000
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: