fix column class name for table list cells

This commit is contained in:
rolux 2013-02-08 17:49:27 +05:30
parent f64ee18aa4
commit 32271e2578

View file

@ -416,7 +416,7 @@ Ox.TableList = function(options, self) {
self.visibleColumns.forEach(function(column, i) {
var $resize;
self.$heads[i] = Ox.Element()
.addClass('OxHeadCell OxColumn' + Ox.toTitleCase(column.id))
.addClass('OxHeadCell ' + getColumnClassName(column.id))
.css({width: self.columnWidths[i] - 5 + 'px'})
.appendTo(that.$head.$content.$element);
// if sort operator is set, bind click event
@ -536,7 +536,7 @@ Ox.TableList = function(options, self) {
$cell = $('<div>');
}
$cell.addClass(
'OxCell OxColumn' + v.id[0].toUpperCase() + v.id.slice(1)
'OxCell ' + getColumnClassName(v.id)
+ (clickable ? ' OxClickable' : '')
+ (editable ? ' OxEditable' : '')
)
@ -568,7 +568,7 @@ Ox.TableList = function(options, self) {
startPos: getColumnPositionById(id)
}
self.drag.stopPos = self.drag.startPos;
$('.OxColumn' + Ox.toTitleCase(id)).css({opacity: 0.25});
$('.' + getColumnClassName(id)).css({opacity: 0.25});
self.drag.startPos > 0 && self.$heads[self.drag.startPos].prev().children().eq(2).css({opacity: 0.25});
self.$heads[self.drag.startPos].next().children().eq(0).css({opacity: 0.25});
self.$heads[self.drag.startPos].addClass('OxDrag').css({ // fixme: why does the class not work?
@ -629,7 +629,7 @@ Ox.TableList = function(options, self) {
self.columnWidths.splice(self.drag.stopPos, 0, width);
that.$head.$content.empty();
constructHead();
$('.OxColumn' + Ox.toTitleCase(id)).css({opacity: 1});
$('.' + getColumnClassName(id)).css({opacity: 1});
self.$heads[self.drag.stopPos].removeClass('OxDrag').css({
cursor: 'pointer'
});
@ -709,10 +709,14 @@ Ox.TableList = function(options, self) {
var $item = getItem(id);
key = key || ''; // fixme: what is this?
return $($item.find(
'.OxCell.OxColumn' + key[0].toUpperCase() + key.slice(1)
'.OxCell.' + getColumnClassName(key)
)[0]);
}
function getColumnClassName(id) {
return 'OxColumn' + id[0].toUpperCase() + id.slice(1);
}
function getColumnOffsets() {
return self.visibleColumns.map(function(column, i) {
return Ox.sum(self.visibleColumns.map(function(column_, i_) {
@ -764,8 +768,8 @@ Ox.TableList = function(options, self) {
//Ox.Log('List', 'moveColumn', id, pos)
var startPos = getColumnPositionById(id),
stopPos = pos,
startSelector = '.OxColumn' + Ox.toTitleCase(id),
stopSelector = '.OxColumn' + Ox.toTitleCase(self.visibleColumns[stopPos].id),
startSelector = '.' + getColumnClassName(id),
stopSelector = '.' + getColumnClassName(self.visibleColumns[stopPos].id),
insert = startPos < stopPos ? 'insertAfter' : 'insertBefore',
$column = $('.OxHeadCell' + startSelector),
$resize = $column.next();
@ -803,7 +807,7 @@ Ox.TableList = function(options, self) {
var index = getColumnIndexById(id),
itemWidth,
position = getColumnPositionById(id),
selector = '.OxColumn' + Ox.toTitleCase(id),
selector = '.' + getColumnClassName(id),
$column = $('.OxHeadCell ' + selector),
$order = $column.next(),
$resize = $order.next();
@ -854,7 +858,9 @@ Ox.TableList = function(options, self) {
width: width - 9 - (i == self.selectedColumn ? 16 : 0) + 'px'
});
}
that.find('.OxCell.OxColumn' + Ox.toTitleCase(self.options.columns[i].id)).css({
that.find(
'.OxCell.' + getColumnClassName(self.options.columns[i].id)
).css({
width: width - (self.options.columnsVisible ? 9 : 8) + 'px'
});
setWidth();