Commit 49b09b94 authored by Boris Kocherov's avatar Boris Kocherov

fix getContent for arrays -- add data-gadget-parent-scope

parent f6fb8ee4
......@@ -108,6 +108,8 @@
return g.declareGadget('gadget_json_generated_form.html', {scope: scope})
.push(function (form_gadget) {
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 {
......@@ -577,16 +579,17 @@
});
}
for (scope in options.arrays) {
if (options.arrays.hasOwnProperty(scope)) {
array = g.element.querySelector("div[data-json-path='" + scope + "']")
.querySelectorAll("div[data-json-parent='" + scope + "']");
for (path in options.arrays) {
if (options.arrays.hasOwnProperty(path)) {
array = g.element.querySelector("div[data-json-path='" + path + "']")
.querySelectorAll("div[data-json-parent='" + path + "']" +
"[data-gadget-parent-scope='" + g.element.getAttribute("data-gadget-scope") + "']");
len = array.length;
for (i = 0; i < len; i = i + 1) {
getContentAndPushArray(
array[i].getAttribute('data-gadget-scope'),
// slice remove concluding '/'
scope.slice(0, -1)
path.slice(0, -1)
);
}
}
......
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