1
0
Fork 0
forked from 0x2620/oxjs

allow for editing lat/lng/s/w/n/e via map

This commit is contained in:
rolux 2011-05-30 09:21:11 +02:00
commit 7eb6f58312
4 changed files with 32 additions and 23 deletions

View file

@ -392,26 +392,28 @@ Ox.TextList = function(options, self) {
borderRightWidth: (self.options.columnsVisible ? 1 : 0) + 'px',
textAlign: v.align
})
.html(v.id in data ? formatValue(data[v.id], v.format) : '')
.html(v.id in data ? formatValue(v.id, data[v.id]) : '')
.appendTo($item);
});
function formatValue(value, format) {
if (value === null) {
value = '';
} else if (format) {
value = Ox.isObject(format) ?
Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, $.merge([value], format.args)) :
format(value);
} else if (Ox.isArray(value)) {
value = value.join(', ');
}
return value;
}
//Math.random() < 0.01 && Ox.print('item', data, $item);
return $item;
}
function formatValue(key, value) {
var format = self.format[key];
if (value === null) {
value = '';
} else if (format) {
value = Ox.isObject(format) ?
Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, $.merge([value], format.args)) :
format(value);
} else if (Ox.isArray(value)) {
value = value.join(', ');
}
return value;
}
function dragstartColumn(id, e) {
self.drag = {
startX: e.clientX,
@ -846,7 +848,8 @@ Ox.TextList = function(options, self) {
return that.$body.value(id, key);
} else {
that.$body.value(id, key, value);
$cell && $cell.html(column.format ? column.format(value) : value);
Ox.print('? ? ?', column, column.format)
$cell && $cell.html(formatValue(key, value));
if (key == self.options.sort[0].key) {
that.$body.sort();
}