diff --git a/bi/base.js b/bi/base.js index 42fda510e..24f6c8217 100644 --- a/bi/base.js +++ b/bi/base.js @@ -42,9 +42,6 @@ } else { this.onmousewheel = handler; } - // Store the line height and page height for this particular element - $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); - $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); }, teardown: function() { @@ -55,22 +52,6 @@ } else { this.onmousewheel = null; } - // Clean up the data we added to the element - $.removeData(this, 'mousewheel-line-height'); - $.removeData(this, 'mousewheel-page-height'); - }, - - getLineHeight: function(elem) { - var $elem = $(elem), - $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); - if (!$parent.length) { - $parent = $('body'); - } - return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; - }, - - getPageHeight: function(elem) { - return $(elem).height(); }, settings: { @@ -136,12 +117,12 @@ // * deltaMode 1 is by lines // * deltaMode 2 is by pages if ( orgEvent.deltaMode === 1 ) { - var lineHeight = $.data(this, 'mousewheel-line-height'); + var lineHeight = 40; delta *= lineHeight; deltaY *= lineHeight; deltaX *= lineHeight; } else if ( orgEvent.deltaMode === 2 ) { - var pageHeight = $.data(this, 'mousewheel-page-height'); + var pageHeight = 800; delta *= pageHeight; deltaY *= pageHeight; deltaX *= pageHeight; @@ -28329,8 +28310,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.CollectionTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -28466,6 +28446,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); this._width = o.width - BI.GridTableScrollbar.SIZE; this._height = o.height - BI.GridTableScrollbar.SIZE; + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0 || o.header.length < 0) { this._digest(); this._populate(); @@ -28864,8 +28848,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { }); }, - _init: function () { - BI.QuickCollectionTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickCollectionTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftCollection.setOverflowX(false); this.topLeftCollection.setOverflowY(false); @@ -28875,6 +28859,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { this.bottomLeftCollection.setOverflowY(false); this.bottomRightCollection.setOverflowX(false); this.bottomRightCollection.setOverflowY(false); + }, + + mounted: function () { + BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), @@ -29069,8 +29058,7 @@ BI.GridTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.GridTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -29213,6 +29201,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this._height = o.height - BI.GridTableScrollbar.SIZE; this.header = this._getHeader(); this.items = this._getItems(); + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0) { this._populate(); } @@ -29531,8 +29523,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { }); }, - _init: function () { - BI.QuickGridTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickGridTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftGrid.setOverflowX(false); this.topLeftGrid.setOverflowY(false); @@ -29542,6 +29534,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { this.bottomLeftGrid.setOverflowY(false); this.bottomRightGrid.setOverflowX(false); this.bottomRightGrid.setOverflowY(false); + }, + + mounted: function () { + BI.QuickGridTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), @@ -29711,8 +29708,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { }) }, - _init: function () { - BI.GridTableScrollbar.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this.focused = false; this.isDragging = false; @@ -29730,6 +29726,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { top: 0 }] }); + }, + + mounted: function () { + var self = this, o = this.options; var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY; this._wheelHandler = new BI.WheelHandler( BI.bind(onWheel, this), diff --git a/bi/core.js b/bi/core.js index 34724f77b..a176df9ba 100644 --- a/bi/core.js +++ b/bi/core.js @@ -4484,6 +4484,10 @@ BI.Widget = BI.inherit(BI.OB, { this.destroyed && this.destroyed(); }, + isMounted: function () { + return this._isMounted; + }, + setWidth: function (w) { this.options.width = w; this._initElementWidth(); diff --git a/dist/base.js b/dist/base.js index 42fda510e..24f6c8217 100644 --- a/dist/base.js +++ b/dist/base.js @@ -42,9 +42,6 @@ } else { this.onmousewheel = handler; } - // Store the line height and page height for this particular element - $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); - $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); }, teardown: function() { @@ -55,22 +52,6 @@ } else { this.onmousewheel = null; } - // Clean up the data we added to the element - $.removeData(this, 'mousewheel-line-height'); - $.removeData(this, 'mousewheel-page-height'); - }, - - getLineHeight: function(elem) { - var $elem = $(elem), - $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); - if (!$parent.length) { - $parent = $('body'); - } - return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; - }, - - getPageHeight: function(elem) { - return $(elem).height(); }, settings: { @@ -136,12 +117,12 @@ // * deltaMode 1 is by lines // * deltaMode 2 is by pages if ( orgEvent.deltaMode === 1 ) { - var lineHeight = $.data(this, 'mousewheel-line-height'); + var lineHeight = 40; delta *= lineHeight; deltaY *= lineHeight; deltaX *= lineHeight; } else if ( orgEvent.deltaMode === 2 ) { - var pageHeight = $.data(this, 'mousewheel-page-height'); + var pageHeight = 800; delta *= pageHeight; deltaY *= pageHeight; deltaX *= pageHeight; @@ -28329,8 +28310,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.CollectionTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -28466,6 +28446,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); this._width = o.width - BI.GridTableScrollbar.SIZE; this._height = o.height - BI.GridTableScrollbar.SIZE; + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0 || o.header.length < 0) { this._digest(); this._populate(); @@ -28864,8 +28848,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { }); }, - _init: function () { - BI.QuickCollectionTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickCollectionTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftCollection.setOverflowX(false); this.topLeftCollection.setOverflowY(false); @@ -28875,6 +28859,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { this.bottomLeftCollection.setOverflowY(false); this.bottomRightCollection.setOverflowX(false); this.bottomRightCollection.setOverflowY(false); + }, + + mounted: function () { + BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), @@ -29069,8 +29058,7 @@ BI.GridTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.GridTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -29213,6 +29201,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this._height = o.height - BI.GridTableScrollbar.SIZE; this.header = this._getHeader(); this.items = this._getItems(); + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0) { this._populate(); } @@ -29531,8 +29523,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { }); }, - _init: function () { - BI.QuickGridTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickGridTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftGrid.setOverflowX(false); this.topLeftGrid.setOverflowY(false); @@ -29542,6 +29534,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { this.bottomLeftGrid.setOverflowY(false); this.bottomRightGrid.setOverflowX(false); this.bottomRightGrid.setOverflowY(false); + }, + + mounted: function () { + BI.QuickGridTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), @@ -29711,8 +29708,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { }) }, - _init: function () { - BI.GridTableScrollbar.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this.focused = false; this.isDragging = false; @@ -29730,6 +29726,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { top: 0 }] }); + }, + + mounted: function () { + var self = this, o = this.options; var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY; this._wheelHandler = new BI.WheelHandler( BI.bind(onWheel, this), diff --git a/dist/core.js b/dist/core.js index de470e664..5c1b20386 100644 --- a/dist/core.js +++ b/dist/core.js @@ -14479,6 +14479,10 @@ BI.Widget = BI.inherit(BI.OB, { this.destroyed && this.destroyed(); }, + isMounted: function () { + return this._isMounted; + }, + setWidth: function (w) { this.options.width = w; this._initElementWidth(); diff --git a/src/base/table/table.collection.js b/src/base/table/table.collection.js index 65b56b954..59267c613 100644 --- a/src/base/table/table.collection.js +++ b/src/base/table/table.collection.js @@ -23,8 +23,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.CollectionTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -160,6 +159,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); this._width = o.width - BI.GridTableScrollbar.SIZE; this._height = o.height - BI.GridTableScrollbar.SIZE; + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0 || o.header.length < 0) { this._digest(); this._populate(); diff --git a/src/base/table/table.collection.quick.js b/src/base/table/table.collection.quick.js index 9cada8003..ab1cd926f 100644 --- a/src/base/table/table.collection.quick.js +++ b/src/base/table/table.collection.quick.js @@ -12,8 +12,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { }); }, - _init: function () { - BI.QuickCollectionTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickCollectionTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftCollection.setOverflowX(false); this.topLeftCollection.setOverflowY(false); @@ -23,6 +23,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { this.bottomLeftCollection.setOverflowY(false); this.bottomRightCollection.setOverflowX(false); this.bottomRightCollection.setOverflowY(false); + }, + + mounted: function () { + BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), diff --git a/src/base/table/table.grid.js b/src/base/table/table.grid.js index 4c357ed38..73d42b385 100644 --- a/src/base/table/table.grid.js +++ b/src/base/table/table.grid.js @@ -20,8 +20,7 @@ BI.GridTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.GridTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -164,6 +163,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this._height = o.height - BI.GridTableScrollbar.SIZE; this.header = this._getHeader(); this.items = this._getItems(); + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0) { this._populate(); } diff --git a/src/base/table/table.grid.quick.js b/src/base/table/table.grid.quick.js index bfa5196b6..5ade73e43 100644 --- a/src/base/table/table.grid.quick.js +++ b/src/base/table/table.grid.quick.js @@ -12,8 +12,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { }); }, - _init: function () { - BI.QuickGridTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickGridTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftGrid.setOverflowX(false); this.topLeftGrid.setOverflowY(false); @@ -23,6 +23,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { this.bottomLeftGrid.setOverflowY(false); this.bottomRightGrid.setOverflowX(false); this.bottomRightGrid.setOverflowY(false); + }, + + mounted: function () { + BI.QuickGridTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), diff --git a/src/base/table/table.grid.scrollbar.js b/src/base/table/table.grid.scrollbar.js index bf8364612..32f9e71fe 100644 --- a/src/base/table/table.grid.scrollbar.js +++ b/src/base/table/table.grid.scrollbar.js @@ -28,8 +28,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { }) }, - _init: function () { - BI.GridTableScrollbar.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this.focused = false; this.isDragging = false; @@ -47,6 +46,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { top: 0 }] }); + }, + + mounted: function () { + var self = this, o = this.options; var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY; this._wheelHandler = new BI.WheelHandler( BI.bind(onWheel, this), diff --git a/src/core/widget.js b/src/core/widget.js index 693734fc9..bd372a063 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -191,6 +191,10 @@ BI.Widget = BI.inherit(BI.OB, { this.destroyed && this.destroyed(); }, + isMounted: function () { + return this._isMounted; + }, + setWidth: function (w) { this.options.width = w; this._initElementWidth(); diff --git a/src/third/jquery.mousewheel.js b/src/third/jquery.mousewheel.js index d53edb74e..597366353 100644 --- a/src/third/jquery.mousewheel.js +++ b/src/third/jquery.mousewheel.js @@ -42,9 +42,6 @@ } else { this.onmousewheel = handler; } - // Store the line height and page height for this particular element - $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); - $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); }, teardown: function() { @@ -55,22 +52,6 @@ } else { this.onmousewheel = null; } - // Clean up the data we added to the element - $.removeData(this, 'mousewheel-line-height'); - $.removeData(this, 'mousewheel-page-height'); - }, - - getLineHeight: function(elem) { - var $elem = $(elem), - $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); - if (!$parent.length) { - $parent = $('body'); - } - return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; - }, - - getPageHeight: function(elem) { - return $(elem).height(); }, settings: { @@ -136,12 +117,12 @@ // * deltaMode 1 is by lines // * deltaMode 2 is by pages if ( orgEvent.deltaMode === 1 ) { - var lineHeight = $.data(this, 'mousewheel-line-height'); + var lineHeight = 40; delta *= lineHeight; deltaY *= lineHeight; deltaX *= lineHeight; } else if ( orgEvent.deltaMode === 2 ) { - var pageHeight = $.data(this, 'mousewheel-page-height'); + var pageHeight = 800; delta *= pageHeight; deltaY *= pageHeight; deltaX *= pageHeight;