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

View File

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

View File

@ -327,7 +327,7 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
elmts.blankErrorPositions.html(positionsHtml.join("")).sortable().disableSelection(); elmts.blankErrorPositions.html(positionsHtml.join("")).sortable().disableSelection();
var level = DialogSystem.showDialog(frame); var level = DialogSystem.showDialog(frame);
var dismiss = function() { DialogSystem.dismissUntil(level - 1); }; var dismiss = function() { DialogSystem.dismissLevel(level - 1); };
setValueType(criterion.valueType); 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++) { for (var i = 0; i < this._sorting.criteria.length; i++) {
if (this._sorting.criteria[i].column == criterion.column) { if (this._sorting.criteria[i].column == criterion.column) {
this._sorting.criteria[i] = criterion; this._sorting.criteria[i] = criterion;
this.update(); var dismissBusy = DialogSystem.showBusy();
var onDone = function() {
dismissBusy();
}
this.update(onDone);
return; return;
} }
} }
} }
this._sorting.criteria.push(criterion); this._sorting.criteria.push(criterion);
this.update(); var dismissBusy = DialogSystem.showBusy();
var onDone = function() {
dismissBusy();
}
this.update(onDone);
}; };
DataTableView.prototype._createMenuForAllColumns = function(elmt) { DataTableView.prototype._createMenuForAllColumns = function(elmt) {