fix setting sort option for text lists w/o column heads
This commit is contained in:
parent
e10d2fc56a
commit
632eebc26d
|
@ -6934,11 +6934,8 @@ requires
|
||||||
|
|
||||||
function triggerEditEvent($item, $cell) {
|
function triggerEditEvent($item, $cell) {
|
||||||
that.triggerEvent('edit', {
|
that.triggerEvent('edit', {
|
||||||
id: $item.attr('id'),
|
id: $item.data('id'),
|
||||||
key: $cell.attr('class').split('OxColumn')[1].split(' ')[0].toLowerCase(),
|
key: $cell.attr('class').split('OxColumn')[1].split(' ')[0].toLowerCase()
|
||||||
// fixme: it'd be nice if we didn't have to pass elements around
|
|
||||||
item: $item,
|
|
||||||
cell: $cell
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7152,10 +7149,13 @@ requires
|
||||||
that.$element = self.options.construct(self.data)
|
that.$element = self.options.construct(self.data)
|
||||||
.addClass('OxItem')
|
.addClass('OxItem')
|
||||||
.attr({
|
.attr({
|
||||||
draggable: self.options.draggable,
|
draggable: self.options.draggable
|
||||||
id: self.options.id
|
//id: self.options.id.replace(/./g, '_') // fixme: dots are not the only problem
|
||||||
})
|
})
|
||||||
.data('position', self.options.position);
|
.data({
|
||||||
|
id: self.options.id,
|
||||||
|
position: self.options.position
|
||||||
|
});
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
|
@ -7191,6 +7191,10 @@ requires
|
||||||
.addClass('OxTextList');
|
.addClass('OxTextList');
|
||||||
|
|
||||||
$.each(self.options.columns, function(i, v) { // fixme: can this go into a generic ox.js function?
|
$.each(self.options.columns, function(i, v) { // fixme: can this go into a generic ox.js function?
|
||||||
|
// fixme: and can't these just remain undefined?
|
||||||
|
if (Ox.isUndefined(v.editable)) {
|
||||||
|
v.editable = false;
|
||||||
|
}
|
||||||
if (Ox.isUndefined(v.unique)) {
|
if (Ox.isUndefined(v.unique)) {
|
||||||
v.unique = false;
|
v.unique = false;
|
||||||
}
|
}
|
||||||
|
@ -7526,14 +7530,15 @@ requires
|
||||||
that.$body.clearCache();
|
that.$body.clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
function editCell(id, key, $item, $cell) {
|
function editCell(id, key) {
|
||||||
Ox.print('editCell')
|
Ox.print('editCell')
|
||||||
var $input,
|
var $item = getItem(id),
|
||||||
|
$cell = getCell(id, key),
|
||||||
|
$input,
|
||||||
html = $cell.html(),
|
html = $cell.html(),
|
||||||
index = getColumnIndexById(key),
|
index = getColumnIndexById(key),
|
||||||
column = self.options.columns[index],
|
column = self.options.columns[index],
|
||||||
width = column.width;
|
width = column.width;
|
||||||
Ox.print($item, $cell)
|
|
||||||
$cell.empty()
|
$cell.empty()
|
||||||
.addClass('OxEdit')
|
.addClass('OxEdit')
|
||||||
.css({
|
.css({
|
||||||
|
@ -7559,6 +7564,7 @@ requires
|
||||||
function submit() {
|
function submit() {
|
||||||
var value = $input.value();
|
var value = $input.value();
|
||||||
//$input.loseFocus().remove();
|
//$input.loseFocus().remove();
|
||||||
|
// fixme: leaky, inputs remain in focus stack
|
||||||
$cell.removeClass('OxEdit')
|
$cell.removeClass('OxEdit')
|
||||||
.css({
|
.css({
|
||||||
width: (width - 8) + 'px'
|
width: (width - 8) + 'px'
|
||||||
|
@ -7572,6 +7578,11 @@ requires
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCell(id, key) {
|
||||||
|
var $item = getItem(id);
|
||||||
|
return $($item.find('.OxCell.OxColumn' + Ox.toTitleCase(key))[0]);
|
||||||
|
}
|
||||||
|
|
||||||
function getColumnIndexById(id) {
|
function getColumnIndexById(id) {
|
||||||
return Ox.getPositionById(self.options.columns, id);
|
return Ox.getPositionById(self.options.columns, id);
|
||||||
}
|
}
|
||||||
|
@ -7580,6 +7591,18 @@ requires
|
||||||
return Ox.getPositionById(self.visibleColumns, id);
|
return Ox.getPositionById(self.visibleColumns, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getItem(id) {
|
||||||
|
var $item = null;
|
||||||
|
$.each(that.find('.OxItem'), function(i, v) {
|
||||||
|
$v = $(v);
|
||||||
|
if ($v.data('id') == id) {
|
||||||
|
$item = $v;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return $item;
|
||||||
|
}
|
||||||
|
|
||||||
function getItemWidth() {
|
function getItemWidth() {
|
||||||
return Math.max(Ox.sum(self.columnWidths), that.$element.width() - oxui.scrollbarSize);
|
return Math.max(Ox.sum(self.columnWidths), that.$element.width() - oxui.scrollbarSize);
|
||||||
//return Ox.sum(self.columnWidths)
|
//return Ox.sum(self.columnWidths)
|
||||||
|
@ -7711,16 +7734,16 @@ requires
|
||||||
that.$body.closePreview();
|
that.$body.closePreview();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.size = function() {
|
|
||||||
setWidth();
|
|
||||||
that.$body.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
that.resizeColumn = function(id, width) {
|
that.resizeColumn = function(id, width) {
|
||||||
resizeColumn(id, width);
|
resizeColumn(id, width);
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
that.size = function() {
|
||||||
|
setWidth();
|
||||||
|
that.$body.size();
|
||||||
|
}
|
||||||
|
|
||||||
that.sortList = function(key, operator) {
|
that.sortList = function(key, operator) {
|
||||||
var isSelected = key == self.options.sort[0].key;
|
var isSelected = key == self.options.sort[0].key;
|
||||||
self.options.sort = [
|
self.options.sort = [
|
||||||
|
@ -7729,17 +7752,27 @@ requires
|
||||||
operator: operator
|
operator: operator
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
if (isSelected) {
|
if (self.options.columnsVisible) {
|
||||||
updateOrder(self.options.columns[self.selectedColumn].id);
|
if (isSelected) {
|
||||||
} else {
|
updateOrder(self.options.columns[self.selectedColumn].id);
|
||||||
toggleSelected(self.options.columns[self.selectedColumn].id);
|
} else {
|
||||||
self.selectedColumn = getColumnIndexById(key);
|
toggleSelected(self.options.columns[self.selectedColumn].id);
|
||||||
toggleSelected(self.options.columns[self.selectedColumn].id);
|
self.selectedColumn = getColumnIndexById(key);
|
||||||
|
toggleSelected(self.options.columns[self.selectedColumn].id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
that.$body.sortList(self.options.sort[0].key, self.options.sort[0].operator);
|
that.$body.sortList(self.options.sort[0].key, self.options.sort[0].operator);
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.value = function(id, key, value) {
|
||||||
|
if (Ox.isUndefined(value)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return that;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user