diff --git a/source/Ox.UI/js/List/List.js b/source/Ox.UI/js/List/List.js index b66d9367..e181c5e3 100644 --- a/source/Ox.UI/js/List/List.js +++ b/source/Ox.UI/js/List/List.js @@ -5,6 +5,7 @@ Ox.List List constructor options Options object centered if true, and orientation is 'horizontal', then keep the selected item centered construct (data) returns the list item HTML + disableHorizontalScrolling If true, disable scrolling draggable If true, items can be dragged format <[]> ??? itemHeight item height @@ -64,6 +65,7 @@ Ox.List = function(options, self) { _tree: false, centered: false, construct: null, + disableHorizonzalScrolling: false, draggable: false, format: [], itemHeight: 16, @@ -583,7 +585,11 @@ Ox.List = function(options, self) { } function getHeight() { - return that.height() - (that.$content.width() > that.width() ? Ox.UI.SCROLLBAR_SIZE : 0); + return that.height() - ( + !self.options.disableHorizontalScrolling + && that.$content.width() > that.width() + ? Ox.UI.SCROLLBAR_SIZE : 0 + ); } function getListSize() { diff --git a/source/Ox.UI/js/List/TableList.js b/source/Ox.UI/js/List/TableList.js index 8994a74e..d20b1e16 100644 --- a/source/Ox.UI/js/List/TableList.js +++ b/source/Ox.UI/js/List/TableList.js @@ -24,6 +24,7 @@ Ox.TableList TableList Widget columnsResizable If true, columns are resizable columnsVisible If true, columns are visible columnWidth <[n]|[40, 800]> Minimum and maximum column width + disableHorizontalScrolling If true, disable scrolling draggable If true, items can be dragged id Id items function() {} {sort, range, keys, callback} or array @@ -107,10 +108,6 @@ Ox.TableList = function(options, self) { }) .addClass('OxTableList'); - if (!self.options.disableHorizontalScrolling) { - enableHorizontalScrolling(); - } - self.options.columns.forEach(function(column) { // fixme: can this go into a generic ox.js function? // fixme: and can't these just remain undefined? if (Ox.isUndefined(column.align)) { @@ -246,6 +243,7 @@ Ox.TableList = function(options, self) { that.$body = Ox.List({ construct: constructItem, + disableHorizontalScrolling: self.options.disableHorizontalScrolling, draggable: self.options.draggable, id: self.options.id, itemHeight: 16, @@ -306,6 +304,10 @@ Ox.TableList = function(options, self) { width: getItemWidth() + 'px' }); + self.options.disableHorizontalScrolling + ? disableHorizontalScrolling() + : enableHorizontalScrolling(); + //Ox.Log('List', 's.vC', self.visibleColumns) function addColumn(id) { @@ -520,7 +522,10 @@ Ox.TableList = function(options, self) { } function disableHorizontalScrolling() { - that.$body.css({overflowX: 'hidden'}); + that.$body.options({ + disableHorizontalScrolling: true + }) + .css({overflowX: 'hidden'}); // fixme: is there a way to pass an array? that.unbindEvent('key_left').unbindEvent('key_right'); } @@ -627,7 +632,10 @@ Ox.TableList = function(options, self) { } function enableHorizontalScrolling() { - that.$body && that.$body.css({overflowX: 'auto'}); + that.$body.options({ + disableHorizontalScrolling: false + }) + .css({overflowX: 'auto'}); that.bindEvent({ key_left: function () { var $element = that.$body.$element,