update sort after edit

This commit is contained in:
rolux 2011-05-24 16:51:40 +02:00
parent 74802d284a
commit 314fcc7b0a
3 changed files with 12 additions and 2 deletions

View file

@ -1503,6 +1503,12 @@ Ox.List = function(options, self) {
return that; return that;
} }
// needed when a value has changed
// but, fixme: better function name
that.sort = function() {
updateSort();
}
/*@ /*@
sortList <f> sort list sortList <f> sort list
(key, operator) -> <f> returns List Element (key, operator) -> <f> returns List Element

View file

@ -489,7 +489,7 @@ Ox.TextList = function(options, self) {
Ox.forEach(self.options.items, function(item, i) { Ox.forEach(self.options.items, function(item, i) {
var value = ( var value = (
sort.map ? sort.map(item[sort.key]) : item[sort.key] sort.map ? sort.map(item[sort.key]) : item[sort.key]
).toLowerCase(); ).toString().toLowerCase();
if (Ox.startsWith(value, query)) { if (Ox.startsWith(value, query)) {
that.$body.options({selected: [item[self.unique]]}); that.$body.options({selected: [item[self.unique]]});
Ox.print('QUERY', query, 'VALUE', value) Ox.print('QUERY', query, 'VALUE', value)
@ -826,7 +826,10 @@ Ox.TextList = function(options, self) {
} else { } else {
that.$body.value(id, key, value); that.$body.value(id, key, value);
$cell && $cell.html(column.format ? column.format(value) : value); $cell && $cell.html(column.format ? column.format(value) : value);
/* if (key == self.options.sort[0].key) {
that.$body.sort();
}
/* fixme: something like this is needed:
if (column.unique) { if (column.unique) {
that.$body.setId($item.data('id'), value); that.$body.setId($item.data('id'), value);
$item.data({id: value}); $item.data({id: value});

View file

@ -244,6 +244,7 @@ Ox.ListMap = function(options, self) {
.bindEvent({ .bindEvent({
'delete': removeItem, 'delete': removeItem,
init: initList, init: initList,
// fixme: do we need 0/shift-0? return already zooms to place
key_0: function() { key_0: function() {
self.$map.panToPlace(); self.$map.panToPlace();
}, },