Преглед изворни кода

修复日期选择组件在表单中跟随滚动条滚动的问题

unknown пре 5 година
родитељ
комит
9182b571b6
1 измењених фајлова са 30 додато и 0 уклоњено
  1. 30 0
      o2web/source/x_component_process_Xform/Calendar.js

+ 30 - 0
o2web/source/x_component_process_Xform/Calendar.js

@@ -42,6 +42,7 @@ MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar =  new Class({
         return value;
     },
 	clickSelect: function(){
+	    debugger;
         var _self = this;
         if (!this.calendar){
             MWF.require("MWF.widget.Calendar", function(){
@@ -77,16 +78,45 @@ MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar =  new Class({
                                 edge: 'leftCenter'
                                 //offset : { y : -25 }
                             });
+                        }else{
+                            var parent = _self.node.getParent();
+                            while( parent ){
+                                var overflow = parent.getStyle("overflow");
+                                var overflowY = parent.getStyle("overflow-y");
+                                if(  overflow === "auto" || overflow === "scroll" || overflowY === "auto" || overflowY === "scroll" ){
+                                    _self.scrollFun = function( e ){
+                                        if (this.container.position ) {
+                                            this.container.position({
+                                                relativeTo: this.node,
+                                                position: 'bottomLeft',
+                                                edge: 'upperLeft',
+                                                allowNegative : true
+                                            });
+                                        }
+                                    }.bind(this);
+                                    _self.scrollParentNode = parent;
+                                    parent.addEvent( "scroll", _self.scrollFun );
+                                    parent = null;
+                                }else{
+                                    parent = parent.getParent();
+                                }
+                            }
                         }
                         _self.fireEvent("show");
                     },
                     "onHide": function(){
                         if (!this.node.getFirst().get("value")) if (this.descriptionNode)  this.descriptionNode.setStyle("display", "block");
+                        if( _self.scrollParentNode && _self.scrollFun ){
+                            _self.scrollParentNode.removeEvent("scroll", _self.scrollFun);
+                        }
                         _self.fireEvent("hide");
                     }.bind(this)
                 };
                 options.baseDate = this.getBaseDate();
                 this.calendar = new MWF.widget.Calendar(this.node.getFirst(), options);
+                if( this.form.json && this.form.json.canlendarStyle && typeOf( this.form.json.canlendarStyle.zIndex ) !== "null" && typeOf( this.form.json.canlendarStyle.zIndex ) !== "undefined" ){
+                    this.calendar.container.setStyle("z-index", this.form.json.canlendarStyle.zIndex );
+                }
                 this.calendar.show();
             }.bind(this));
         }else{