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

nested menupopup opening direction

    XMLWordPrintable

    Details

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

      Description

      Steps to Reproduce

      run the example menupopup-direction.zul
      open the menupopups to deeper levels

      Current Result

      the menu strangely keeps opening left/right/left/right after reaching the right screen border.

      especially annoying when starting the menu from the right

      Expected Result

      use the screen area available before switching direction
      e.g from left

      or right

      Debug Info

      Root Cause

      Workaround

      commented out in the attached example:

      	zk.afterLoad('zul.menu', function() {
      		var xMenupopup = {};
      		zk.override(zul.menu.Menupopup.prototype, xMenupopup, {
      			open : function (ref, offset, position, opts) {
      				if(!offset && !position) {
      					this._reverseDir = this._parentPopup()._reverseDir || false;
      					if(this._reverseDir) position = 'start_before';
      				}
      				xMenupopup.open.call(this, ref, offset, position, opts);
      			},
      			_syncPos : function () {
      				var parentPopup = this._parentPopup();
      				if(parentPopup && zk(this).isOverlapped(parentPopup.$n(), 5)) {
      					this._reverseDir = !this._reverseDir;
      					var position = this._reverseDir ? 'start_before' : 'end_before';
      					zk(this).position(this.parent.$n().getBoundingClientRect(), position, {})
      				}
      			},
      			_parentPopup : function () {
      				return jq(this.parent).closest('@menupopup').zk.$();
      			}
      
      		});//zk.override
      	});//zk.afterLoad
      

        Attachments

          Activity

            People

            Assignee:
            CharlesQiu CharlesQiu
            Reporter:
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 3 hours
                1d 3h