When sorting, it's now possible to specify where to put blanks and errors relative to the valid values.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@837 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
369a02043c
commit
4e6b915bc1
@ -33,7 +33,7 @@ abstract public class Criterion {
|
|||||||
blankPosition = obj.getInt("blankPosition");
|
blankPosition = obj.getInt("blankPosition");
|
||||||
}
|
}
|
||||||
if (obj.has("errorPosition") && !obj.isNull("errorPosition")) {
|
if (obj.has("errorPosition") && !obj.isNull("errorPosition")) {
|
||||||
blankPosition = obj.getInt("errorPosition");
|
errorPosition = obj.getInt("errorPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.has("reverse") && !obj.isNull("reverse")) {
|
if (obj.has("reverse") && !obj.isNull("reverse")) {
|
||||||
|
@ -1178,11 +1178,7 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
|
|||||||
'</table></div>' +
|
'</table></div>' +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
'<td>' +
|
'<td>' +
|
||||||
'<ul>' +
|
'<ul class="sorting-dialog-blank-error-positions" bind="blankErrorPositions"></ul>' +
|
||||||
'<li>Valid Values</li>' +
|
|
||||||
'<li>Blanks</li>' +
|
|
||||||
'<li>Errors</li>' +
|
|
||||||
'</ul>' +
|
|
||||||
'<p>Drag and drop to re-order</p>' +
|
'<p>Drag and drop to re-order</p>' +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
'</tr>' +
|
'</tr>' +
|
||||||
@ -1231,6 +1227,29 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
|
|||||||
bodyElmts.sortAloneContainer.show();
|
bodyElmts.sortAloneContainer.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var validValuesHtml = '<li kind="value">Valid Values</li>';
|
||||||
|
var blankValuesHtml = '<li kind="blank">Blanks</li>';
|
||||||
|
var errorValuesHtml = '<li kind="error">Errors</li>';
|
||||||
|
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(
|
footer.html(
|
||||||
'<button bind="okButton"> OK </button>' +
|
'<button bind="okButton"> OK </button>' +
|
||||||
'<button bind="cancelButton">Cancel</button>'
|
'<button bind="cancelButton">Cancel</button>'
|
||||||
@ -1252,6 +1271,20 @@ DataTableColumnHeaderUI.prototype._showSortingCriterion = function(criterion, ha
|
|||||||
reverse: bodyElmts.directionOptions.find("input[type='radio']:checked")[0].value == "reverse"
|
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") {
|
if (criterion2.valueType == "string") {
|
||||||
criterion2.caseSensitive = bodyElmts.caseSensitiveCheckbox[0].checked;
|
criterion2.caseSensitive = bodyElmts.caseSensitiveCheckbox[0].checked;
|
||||||
}
|
}
|
||||||
|
@ -251,4 +251,23 @@ span.data-table-cell-editor-key {
|
|||||||
iframe.data-table-topic-popup-iframe {
|
iframe.data-table-topic-popup-iframe {
|
||||||
background: #DBE8EB;
|
background: #DBE8EB;
|
||||||
border: none;
|
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;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user