Commit c4a0f84d authored by Boris Kocherov's avatar Boris Kocherov

simplify getContent for arrays

parent 6aa0026a
......@@ -156,9 +156,7 @@
form_gadget.element.setAttribute("data-json-parent", parent_path);
form_gadget.element.setAttribute("data-gadget-parent-scope",
g.element.getAttribute("data-gadget-scope"));
if (options.parent_type === "array") {
g.props.arrays[parent_path] = 1;
} else {
if (options.parent_type !== "array") {
g.props.objects[parent_path][property_name] = scope;
form_gadget.element.setAttribute("data-json-property-name", property_name);
}
......@@ -345,6 +343,7 @@
first_path + '/'
);
div.setAttribute("data-json-path", first_path + '/');
gadget.props.arrays[first_path + '/'] = div;
div.setAttribute("data-json-type", json_field.type);
}
......@@ -649,7 +648,7 @@
for (path in options.arrays) {
if (options.arrays.hasOwnProperty(path)) {
array = g.element.querySelector("div[data-json-path='" + path + "']")
array = options.arrays[path]
.querySelectorAll("div[data-json-parent='" + path + "']" +
"[data-gadget-parent-scope='" + g.element.getAttribute("data-gadget-scope") + "']");
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