Commit c4a0f84d authored by Boris Kocherov's avatar Boris Kocherov

simplify getContent for arrays

parent 6aa0026a
...@@ -156,9 +156,7 @@ ...@@ -156,9 +156,7 @@
form_gadget.element.setAttribute("data-json-parent", parent_path); form_gadget.element.setAttribute("data-json-parent", parent_path);
form_gadget.element.setAttribute("data-gadget-parent-scope", form_gadget.element.setAttribute("data-gadget-parent-scope",
g.element.getAttribute("data-gadget-scope")); g.element.getAttribute("data-gadget-scope"));
if (options.parent_type === "array") { if (options.parent_type !== "array") {
g.props.arrays[parent_path] = 1;
} else {
g.props.objects[parent_path][property_name] = scope; g.props.objects[parent_path][property_name] = scope;
form_gadget.element.setAttribute("data-json-property-name", property_name); form_gadget.element.setAttribute("data-json-property-name", property_name);
} }
...@@ -345,6 +343,7 @@ ...@@ -345,6 +343,7 @@
first_path + '/' first_path + '/'
); );
div.setAttribute("data-json-path", first_path + '/'); div.setAttribute("data-json-path", first_path + '/');
gadget.props.arrays[first_path + '/'] = div;
div.setAttribute("data-json-type", json_field.type); div.setAttribute("data-json-type", json_field.type);
} }
...@@ -649,7 +648,7 @@ ...@@ -649,7 +648,7 @@
for (path in options.arrays) { for (path in options.arrays) {
if (options.arrays.hasOwnProperty(path)) { if (options.arrays.hasOwnProperty(path)) {
array = g.element.querySelector("div[data-json-path='" + path + "']") array = options.arrays[path]
.querySelectorAll("div[data-json-parent='" + path + "']" + .querySelectorAll("div[data-json-parent='" + path + "']" +
"[data-gadget-parent-scope='" + g.element.getAttribute("data-gadget-scope") + "']"); "[data-gadget-parent-scope='" + g.element.getAttribute("data-gadget-scope") + "']");
len = array.length; len = array.length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment