update enable/disable horizontal scrolling option in table list

This commit is contained in:
rolux 2012-08-31 08:51:30 +02:00
parent 3fcedf2b30
commit 95502a62a1

View file

@ -60,7 +60,7 @@ Ox.TableList = function(options, self) {
columnsResizable: false, columnsResizable: false,
columnsVisible: false, columnsVisible: false,
columnWidth: [40, 800], columnWidth: [40, 800],
disableHorizontalScroll: false, disableHorizontalScrolling: false,
draggable: false, draggable: false,
id: '', id: '',
items: null, items: null,
@ -78,10 +78,10 @@ Ox.TableList = function(options, self) {
}) })
.options(options || {}) .options(options || {})
.update({ .update({
disableHorizontalScroll: function() { disableHorizontalScrolling: function() {
self.options.disableHorizontalScroll self.options.disableHorizontalScrolling
? disableHorizontalScroll() ? disableHorizontalScrolling()
: enableHorizontalScroll(); : enableHorizontalScrolling();
}, },
items: function() { items: function() {
that.$body.options({items: self.options.items}); that.$body.options({items: self.options.items});
@ -102,8 +102,8 @@ Ox.TableList = function(options, self) {
}) })
.addClass('OxTableList'); .addClass('OxTableList');
if (!self.options.disableHorizontalScroll) { if (!self.options.disableHorizontalScrolling) {
enableHorizontalScroll(); enableHorizontalScrolling();
} }
self.options.columns.forEach(function(column) { // fixme: can this go into a generic ox.js function? self.options.columns.forEach(function(column) { // fixme: can this go into a generic ox.js function?
@ -493,7 +493,8 @@ Ox.TableList = function(options, self) {
return $item; return $item;
} }
function disableHorizontalScroll() { function disableHorizontalScrolling() {
that.$body.css({overflowX: 'hidden'});
// fixme: is there a way to pass an array? // fixme: is there a way to pass an array?
that.unbindEvent('key_left').unbindEvent('key_right'); that.unbindEvent('key_left').unbindEvent('key_right');
} }
@ -599,7 +600,8 @@ Ox.TableList = function(options, self) {
}); });
} }
function enableHorizontalScroll() { function enableHorizontalScrolling() {
that.$body.css({overflowX: 'auto'});
that.bindEvent({ that.bindEvent({
key_left: function () { key_left: function () {
var $element = that.$body.$element, var $element = that.$body.$element,