123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- define("dojox/mobile/ScrollableView", [
- "dojo/_base/array",
- "dojo/_base/declare",
- "dojo/dom-class",
- "dojo/dom-construct",
- "dijit/registry",
- "./View",
- "./_ScrollableMixin"
- ], function(array, declare, domClass, domConstruct, registry, View, ScrollableMixin){
-
-
-
-
-
- return declare("dojox.mobile.ScrollableView", [View, ScrollableMixin], {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- scrollableParams: null,
-
-
- keepScrollPos: false,
- constructor: function(){
- this.scrollableParams = {noResize: true};
- },
- buildRendering: function(){
- this.inherited(arguments);
- domClass.add(this.domNode, "mblScrollableView");
- this.domNode.style.overflow = "hidden";
- this.domNode.style.top = "0px";
- this.containerNode = domConstruct.create("DIV",
- {className:"mblScrollableViewContainer"}, this.domNode);
- this.containerNode.style.position = "absolute";
- this.containerNode.style.top = "0px";
- if(this.scrollDir === "v"){
- this.containerNode.style.width = "100%";
- }
- this.reparent();
- this.findAppBars();
- },
- resize: function(){
-
-
- this.inherited(arguments);
- array.forEach(this.getChildren(), function(child){
- if(child.resize){ child.resize(); }
- });
- },
- isTopLevel: function(e){
-
-
-
- var parent = this.getParent && this.getParent();
- return (!parent || !parent.resize);
- },
- addChild: function(widget, /*Number?*/insertIndex){
- var c = widget.domNode;
- var fixed = this.checkFixedBar(c, true);
- if(fixed){
-
-
-
- this.domNode.appendChild(c);
- if(fixed === "top"){
- this.fixedHeaderHeight = c.offsetHeight;
- this.isLocalHeader = true;
- }else if(fixed === "bottom"){
- this.fixedFooterHeight = c.offsetHeight;
- this.isLocalFooter = true;
- c.style.bottom = "0px";
- }
- this.resize();
- if(this._started && !widget._started){
- widget.startup();
- }
- }else{
- this.inherited(arguments);
- }
- },
- reparent: function(){
-
-
-
- var i, idx, len, c;
- for(i = 0, idx = 0, len = this.domNode.childNodes.length; i < len; i++){
- c = this.domNode.childNodes[idx];
-
- if(c === this.containerNode || this.checkFixedBar(c, true)){
- idx++;
- continue;
- }
- this.containerNode.appendChild(this.domNode.removeChild(c));
- }
- },
- onAfterTransitionIn: function(moveTo, dir, transition, context, method){
- this.flashScrollBar();
- },
-
- getChildren: function(){
-
-
-
- var children = this.inherited(arguments);
- if(this.fixedHeader && this.fixedHeader.parentNode === this.domNode){
- children.push(registry.byNode(this.fixedHeader));
- }
- if(this.fixedFooter && this.fixedFooter.parentNode === this.domNode){
- children.push(registry.byNode(this.fixedFooter));
- }
- return children;
- }
- });
- });
|