Final fix over storing array of data from Datasets
This commit is contained in:
parent
dcf88479bd
commit
e615c403d3
|
@ -245,7 +245,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
||||||
StringBuilder valueBuilder = new StringBuilder();
|
StringBuilder valueBuilder = new StringBuilder();
|
||||||
valueBuilder.append("[");
|
valueBuilder.append("[");
|
||||||
for (int i = 0; i < valueCollection.size(); i++) {
|
for (int i = 0; i < valueCollection.size(); i++) {
|
||||||
valueBuilder.append(parseString(valueCollection.stream().toArray()[i]));
|
valueBuilder.append("\"").append(valueCollection.toArray()[i]).append("\"");
|
||||||
if (i < valueCollection.size() - 1) {
|
if (i < valueCollection.size() - 1) {
|
||||||
valueBuilder.append(", ");
|
valueBuilder.append(", ");
|
||||||
}
|
}
|
||||||
|
@ -264,13 +264,4 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
||||||
public void toMap(Map<String, Object> fieldValues, int index) {
|
public void toMap(Map<String, Object> fieldValues, int index) {
|
||||||
fieldValues.put(this.id, this.value);
|
fieldValues.put(this.id, this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parseString(Object value) {
|
|
||||||
if (value instanceof String) {
|
|
||||||
if (((String)value).contains(",")) {
|
|
||||||
return "\"" + value + "\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -107,7 +107,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
||||||
const originalValue = <string>this.form.get('value').value;
|
const originalValue = <string>this.form.get('value').value;
|
||||||
if (originalValue !== null && typeof originalValue === 'string') {
|
if (originalValue !== null && typeof originalValue === 'string') {
|
||||||
let values = (<string>this.form.get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"'));
|
let values = (<string>this.form.get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"'));
|
||||||
let specialValue = (<string>this.form.get('value').value).split('"').filter((value) => !value.startsWith('[') && !value.endsWith(']') && !values.includes(value));
|
let specialValue = (<string>this.form.get('value').value).split('"').filter((value) => !value.startsWith('[') && !value.endsWith(']') && !values.includes(value) && value !== ', ');
|
||||||
specialValue.forEach(value => values.push(value));
|
specialValue.forEach(value => values.push(value));
|
||||||
if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) {
|
if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) {
|
||||||
values = undefined;
|
values = undefined;
|
||||||
|
|
Loading…
Reference in New Issue