diff --git a/src/main/java/com/metaweb/gridworks/sorting/Criterion.java b/src/main/java/com/metaweb/gridworks/sorting/Criterion.java
index e5793a1ee..f6127be4e 100644
--- a/src/main/java/com/metaweb/gridworks/sorting/Criterion.java
+++ b/src/main/java/com/metaweb/gridworks/sorting/Criterion.java
@@ -33,7 +33,7 @@ abstract public class Criterion {
blankPosition = obj.getInt("blankPosition");
}
if (obj.has("errorPosition") && !obj.isNull("errorPosition")) {
- blankPosition = obj.getInt("errorPosition");
+ errorPosition = obj.getInt("errorPosition");
}
if (obj.has("reverse") && !obj.isNull("reverse")) {
diff --git a/src/main/webapp/scripts/views/data-table-column-header-ui.js b/src/main/webapp/scripts/views/data-table-column-header-ui.js
index a3fb8a145..523269a25 100644
--- a/src/main/webapp/scripts/views/data-table-column-header-ui.js
+++ b/src/main/webapp/scripts/views/data-table-column-header-ui.js
@@ -1178,11 +1178,7 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
'' +
'' +
'
' +
- '' +
- '- Valid Values
' +
- '- Blanks
' +
- '- Errors
' +
- ' ' +
+ '' +
'Drag and drop to re-order ' +
' | ' +
'' +
@@ -1231,6 +1227,29 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
bodyElmts.sortAloneContainer.show();
}
+ var validValuesHtml = 'Valid Values';
+ var blankValuesHtml = 'Blanks';
+ var errorValuesHtml = 'Errors';
+ var positionsHtml;
+ if (criterion.blankPosition < 0) {
+ if (criterion.errorPosition > 0) {
+ positionsHtml = [ blankValuesHtml, validValuesHtml, errorValuesHtml ];
+ } else if (criterion.errorPosition < criterion.blankPosition) {
+ positionsHtml = [ errorValuesHtml, blankValuesHtml, validValuesHtml ];
+ } else {
+ positionsHtml = [ blankValuesHtml, errorValuesHtml, validValuesHtml ];
+ }
+ } else {
+ if (criterion.errorPosition < 0) {
+ positionsHtml = [ errorValuesHtml, validValuesHtml, blankValuesHtml ];
+ } else if (criterion.errorPosition < criterion.blankPosition) {
+ positionsHtml = [ validValuesHtml, errorValuesHtml, blankValuesHtml ];
+ } else {
+ positionsHtml = [ validValuesHtml, blankValuesHtml, errorValuesHtml ];
+ }
+ }
+ bodyElmts.blankErrorPositions.html(positionsHtml.join("")).sortable().disableSelection();
+
footer.html(
'' +
''
@@ -1252,6 +1271,20 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
reverse: bodyElmts.directionOptions.find("input[type='radio']:checked")[0].value == "reverse"
};
+ var valuePosition, blankPosition, errorPosition;
+ bodyElmts.blankErrorPositions.find("li").each(function(index, elmt) {
+ var kind = this.getAttribute("kind");
+ if (kind == "value") {
+ valuePosition = index;
+ } else if (kind == "blank") {
+ blankPosition = index;
+ } else if (kind == "error") {
+ errorPosition = index;
+ }
+ });
+ criterion2.blankPosition = blankPosition - valuePosition;
+ criterion2.errorPosition = errorPosition - valuePosition;
+
if (criterion2.valueType == "string") {
criterion2.caseSensitive = bodyElmts.caseSensitiveCheckbox[0].checked;
}
diff --git a/src/main/webapp/styles/views/data-table-view.css b/src/main/webapp/styles/views/data-table-view.css
index 2cb1cad5c..3237bc9e9 100644
--- a/src/main/webapp/styles/views/data-table-view.css
+++ b/src/main/webapp/styles/views/data-table-view.css
@@ -251,4 +251,23 @@ span.data-table-cell-editor-key {
iframe.data-table-topic-popup-iframe {
background: #DBE8EB;
border: none;
+}
+
+ul.sorting-dialog-blank-error-positions {
+ margin: 0;
+ padding: 5px;
+ height: 10em;
+ border: 1px solid #ccc;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+ul.sorting-dialog-blank-error-positions > li {
+ display: block;
+ border: 1px solid #ccc;
+ background: #eee;
+ padding: 5px;
+ margin: 2px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ cursor: move;
}
\ No newline at end of file