Adds a default separator preference for split/join multi valued cells (#2520)

* default value for split/join

* using the new preference interface

* changed preference name to ui.cell.rowSplitDefaultSeparator
This commit is contained in:
Lisa Chandra 2020-06-25 18:05:53 +05:30 committed by GitHub
parent cfa1038066
commit 7b8f8486f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -116,8 +116,9 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
);
};
var doJoinMultiValueCells = function() {
var separator = window.prompt($.i18n('core-views/enter-separator'), ", ");
var doJoinMultiValueCells = function(separator) {
var defaultValue = Refine.getPreference("ui.cell.rowSplitDefaultSeparator", ",");
var separator = window.prompt($.i18n('core-views/enter-separator'), defaultValue);
if (separator !== null) {
Refine.postCoreProcess(
"join-multi-value-cells",
@ -129,6 +130,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
null,
{ rowsChanged: true }
);
Refine.setPreference("ui.cell.rowSplitDefaultSeparator", separator);
}
};
@ -315,6 +317,8 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
var level = DialogSystem.showDialog(frame);
var dismiss = function() { DialogSystem.dismissUntil(level - 1); };
var defaultValue = Refine.getPreference("ui.cell.rowSplitDefaultSeparator", ",");
elmts.separatorInput[0].value = defaultValue;
elmts.separatorInput.focus().select();
elmts.cancelButton.click(dismiss);
@ -333,7 +337,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}
config.regex = elmts.regexInput[0].checked;
Refine.setPreference("ui.cell.rowSplitDefaultSeparator", config.separator);
} else if (mode === "lengths") {
var s = "[" + elmts.lengthsTextarea[0].value + "]";
try {

View File

@ -14,7 +14,7 @@
</tr>
<tr><td></td>
<td bind="or_views_separator"></td>
<td><input size="10" value="," bind="separatorInput" />
<td><input size="10" bind="separatorInput" />
<input type="checkbox" bind="regexInput" id="$split-multi-valued-cells-regex" />
<label for="$split-multi-valued-cells-regex" bind="or_views_regExp"></label></td>
</tr>