Skip to content
Snippets Groups Projects
Verified Commit 96c999b7 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: new databind for int[] and string[]

parent cb7cd0fe
No related branches found
No related tags found
No related merge requests found
...@@ -964,7 +964,7 @@ function initOptionObserver() { ...@@ -964,7 +964,7 @@ function initOptionObserver() {
/** /**
* @private * @private
* @return {object} * @return {object}
* @throws {TypeError} value is not a object * @throws {TypeError} value is not an object
*/ */
function getOptionsFromScriptTag() { function getOptionsFromScriptTag() {
if (!this.hasAttribute(ATTRIBUTE_OPTIONS_SELECTOR)) { if (!this.hasAttribute(ATTRIBUTE_OPTIONS_SELECTOR)) {
......
...@@ -397,6 +397,30 @@ function retrieveAndSetValue(element) { ...@@ -397,6 +397,30 @@ function retrieveAndSetValue(element) {
case "checkbox": case "checkbox":
value = value === "true" || value === "1" || value === "on"; value = value === "true" || value === "1" || value === "on";
break; break;
case "string[]":
value = value.split(",").map((v) => `${v}`);
break;
case "int[]":
case "integer[]":
if (value === "") {
value = [];
} else {
value = value.split(",").map((v) => {
try {
return parseInt(v, 10);
} catch (e) {
}
return -1;
}).filter((v) => v !== -1);
}
break
case "[]":
case "array": case "array":
case "list": case "list":
value = value.split(","); value = value.split(",");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment