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

View File

@ -14,7 +14,7 @@
</tr> </tr>
<tr><td></td> <tr><td></td>
<td bind="or_views_separator"></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" /> <input type="checkbox" bind="regexInput" id="$split-multi-valued-cells-regex" />
<label for="$split-multi-valued-cells-regex" bind="or_views_regExp"></label></td> <label for="$split-multi-valued-cells-regex" bind="or_views_regExp"></label></td>
</tr> </tr>