Commit 73205edc authored by Boris Kocherov's avatar Boris Kocherov

simplify rerender

parent 12d8ca64
...@@ -247,25 +247,17 @@ ...@@ -247,25 +247,17 @@
gadget_settings, gadget_settings,
path; path;
function f(p) { function f(settings_path, rerender_path) {
var settings;
return g.getDeclaredGadget("xmla_settings") return g.getDeclaredGadget("xmla_settings")
.push(function (gadget) { .push(function (gadget) {
gadget_settings = gadget; gadget_settings = gadget;
return gadget.getContent(p); return gadget.getContent(settings_path);
}) })
.push(function (c) { .push(function (settings) {
settings = c; return generateSchema(settings);
return generateSchema(c);
}) })
.push(function (schema) { .push(function (schema) {
return gadget_settings.getGadgetByPath(p + '/properties') return gadget_settings.rerender(rerender_path, schema);
.push(function (ret) {
return ret.gadget.rerender({
schema: schema,
value: convertOnMultiLevel(settings, '/properties')
});
});
}) })
.push(function () { .push(function () {
// return g.notifyChange(); // return g.notifyChange();
...@@ -275,7 +267,7 @@ ...@@ -275,7 +267,7 @@
for (path in g.props.xmla_connections) { for (path in g.props.xmla_connections) {
if (g.props.xmla_connections.hasOwnProperty(path) && if (g.props.xmla_connections.hasOwnProperty(path) &&
p.startsWith(path)) { p.startsWith(path)) {
return f(path); return f(path, g.props.xmla_connections[path]);
} }
} }
// return g.notifyChange(); // return g.notifyChange();
...@@ -301,7 +293,7 @@ ...@@ -301,7 +293,7 @@
return generateSchema(settings); return generateSchema(settings);
}) })
.push(function (s) { .push(function (s) {
g.props.xmla_connections[connection_path] = false; g.props.xmla_connections[connection_path] = path;
return s; return s;
}); });
} }
......
...@@ -935,6 +935,24 @@ ...@@ -935,6 +935,24 @@
return g; return g;
}); });
}) })
.declareMethod('rerender', function (path, schema) {
var g = this,
gadget;
if (path) {
return g.props.form_gadget.getGadgetByPath(path)
.push(function (ret) {
gadget = ret.gadget;
return gadget.getContent();
})
.push(function (value) {
return gadget.rerender({
schema: schema,
value: value
});
});
}
})
.allowPublicAcquisition("expandSchema", function (arr) { .allowPublicAcquisition("expandSchema", function (arr) {
return expandSchemaForField(this, arr[0], arr[1], arr[2], arr[3]); return expandSchemaForField(this, arr[0], arr[1], arr[2], arr[3]);
}) })
......
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