prevent the multiple sorting

This commit is contained in:
Jacky 2015-05-01 15:04:51 -04:00
parent 9b2a506caa
commit ca862970a4
4 changed files with 25 additions and 12 deletions

View File

@ -91,7 +91,7 @@ public class Engine implements Jsonizable {
_mode = mode;
}
public FilteredRows getAllRows() {
public synchronized FilteredRows getAllRows() {
return new FilteredRows() {
@Override
public void accept(Project project, RowVisitor visitor) {
@ -134,7 +134,7 @@ public class Engine implements Jsonizable {
throw new InternalError("Unknown mode.");
}
public FilteredRecords getAllRecords() {
public synchronized FilteredRecords getAllRecords() {
return new FilteredRecords() {
@Override
public void accept(Project project, RecordVisitor visitor) {

View File

@ -64,13 +64,8 @@ DialogSystem.showDialog = function(elmt, onCancel) {
return level;
};
DialogSystem.dismissAll = function() {
DialogSystem.dismissUntil(0);
};
DialogSystem.dismissUntil = function(level) {
for (var i = DialogSystem._layers.length - 1; i >= level; i--) {
var layer = DialogSystem._layers[i];
DialogSystem.dismissLevel = function(level) {
var layer = DialogSystem._layers[level];
$(document).unbind("keydown", layer.keyHandler);
@ -85,6 +80,15 @@ DialogSystem.dismissUntil = function(level) {
Refine.reportException(e);
}
}
};
DialogSystem.dismissAll = function() {
DialogSystem.dismissUntil(0);
};
DialogSystem.dismissUntil = function(level) {
for (var i = DialogSystem._layers.length - 1; i >= level; i--) {
DialogSystem.dismissLevel(i);
}
DialogSystem._layers = DialogSystem._layers.slice(0, level);
};
@ -107,3 +111,4 @@ DialogSystem.showBusy = function(message) {
DialogSystem.dismissUntil(level - 1);
};
};

View File

@ -327,7 +327,7 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
elmts.blankErrorPositions.html(positionsHtml.join("")).sortable().disableSelection();
var level = DialogSystem.showDialog(frame);
var dismiss = function() { DialogSystem.dismissUntil(level - 1); };
var dismiss = function() { DialogSystem.dismissLevel(level - 1); };
setValueType(criterion.valueType);

View File

@ -544,13 +544,21 @@ DataTableView.prototype._addSortingCriterion = function(criterion, alone) {
for (var i = 0; i < this._sorting.criteria.length; i++) {
if (this._sorting.criteria[i].column == criterion.column) {
this._sorting.criteria[i] = criterion;
this.update();
var dismissBusy = DialogSystem.showBusy();
var onDone = function() {
dismissBusy();
}
this.update(onDone);
return;
}
}
}
this._sorting.criteria.push(criterion);
this.update();
var dismissBusy = DialogSystem.showBusy();
var onDone = function() {
dismissBusy();
}
this.update(onDone);
};
DataTableView.prototype._createMenuForAllColumns = function(elmt) {