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,
columnsVisible: false,
columnWidth: [40, 800],
disableHorizontalScroll: false,
disableHorizontalScrolling: false,
draggable: false,
id: '',
items: null,
@ -78,10 +78,10 @@ Ox.TableList = function(options, self) {
})
.options(options || {})
.update({
disableHorizontalScroll: function() {
self.options.disableHorizontalScroll
? disableHorizontalScroll()
: enableHorizontalScroll();
disableHorizontalScrolling: function() {
self.options.disableHorizontalScrolling
? disableHorizontalScrolling()
: enableHorizontalScrolling();
},
items: function() {
that.$body.options({items: self.options.items});
@ -102,8 +102,8 @@ Ox.TableList = function(options, self) {
})
.addClass('OxTableList');
if (!self.options.disableHorizontalScroll) {
enableHorizontalScroll();
if (!self.options.disableHorizontalScrolling) {
enableHorizontalScrolling();
}
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;
}
function disableHorizontalScroll() {
function disableHorizontalScrolling() {
that.$body.css({overflowX: 'hidden'});
// fixme: is there a way to pass an array?
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({
key_left: function () {
var $element = that.$body.$element,