Commit 795f8518 authored by Boris Kocherov's avatar Boris Kocherov

allow change schema without touch current json_document

parent 93224584
...@@ -661,6 +661,7 @@ ...@@ -661,6 +661,7 @@
return json_document; return json_document;
}) })
.push(function (json_d) { .push(function (json_d) {
gadget.state.value = JSON.stringify(json_d);
return tv4.validateMultiple(json_d, gadget.props.schema[""]); return tv4.validateMultiple(json_d, gadget.props.schema[""]);
}) })
.push(function (validation) { .push(function (validation) {
...@@ -764,14 +765,17 @@ ...@@ -764,14 +765,17 @@
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
return this.changeState({ var z = {
key: options.key, key: options.key,
value: JSON.stringify(options.value),
schema: JSON.stringify(options.schema), schema: JSON.stringify(options.schema),
saveOrigValue: options.saveOrigValue, saveOrigValue: options.saveOrigValue,
schema_url: options.schema_url, schema_url: options.schema_url,
editable: options.editable === undefined ? true : options.editable editable: options.editable === undefined ? true : options.editable
}); };
if (options.value !== undefined) {
z.value = JSON.stringify(options.value);
}
return this.changeState(z);
}) })
.onStateChange(function () { .onStateChange(function () {
var g = this, var g = this,
......
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