avoid .sort if value did not change

This commit is contained in:
j 2016-09-20 01:15:21 +02:00
parent fde3b905f9
commit 9f5af680ed

View file

@ -1238,6 +1238,7 @@ Ox.TableList = function(options, self) {
} else {
that.$body.value(id, Ox.makeObject(args));
Ox.forEach(Ox.makeObject(args), function(value, key) {
var changed = false;
if (key == self.options.unique) {
// unique id has changed
self.options.selected = self.options.selected.map(function(id_) {
@ -1247,9 +1248,13 @@ Ox.TableList = function(options, self) {
}
$cell = getCell(id, key);
if ($cell && !$cell.is('.OxEdit')) {
$cell.html(formatValue(key, value, that.$body.value(id)));
var value = formatValue(key, value, that.$body.value(id));
if (value != $cell.html()) {
$cell.html(value);
changed = true;
}
if (!self.options.sortable && key == self.options.sort[0].key) {
}
if (changed && !self.options.sortable && key == self.options.sort[0].key) {
// sort key has changed
sort = true;
}