Commit 25ae891b authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[renderjs_ui] MatrixBox field implementation

parent b89114c1
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 MatrixBox Field</title>
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="gadget_erp5_field_matrixbox.js" type="text/javascript"></script>
<script id="table-template" type="text/x-handlebars-template">
<thead>
<tr>
<th>{{table_title}}</th>
{{#each header}}
<th>{{this}}</th>
{{/each}}
</tr>
</thead>
</script>
</head>
<body>
<div class="document_table"></div>
</body>
</html>
\ No newline at end of file
...@@ -52,14 +52,12 @@ ...@@ -52,14 +52,12 @@
}); });
}) })
/** Return content even for non-editable cells - be backward compatible! */
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
if (this.state.editable) { return this.getDeclaredGadget('sub')
return this.getDeclaredGadget('sub') .push(function (gadget) {
.push(function (gadget) { return gadget.getContent();
return gadget.getContent(); });
});
}
return {};
}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.60919.29957.58146</string> </value> <value> <string>960.5523.58984.43537</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1482843372.92</float> <float>1503499581.59</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -56,6 +56,19 @@ ...@@ -56,6 +56,19 @@
element.removeChild(element.firstChild); element.removeChild(element.firstChild);
} }
element.appendChild(new_element); element.appendChild(new_element);
})
/** Because of meta-fields (controlling MatrixBox for example) we need to
* obtain value of readonly fields.
* In order to make it more developer-friendly, only named fields return their values.
*/
.declareMethod("getContent", function () {
var data = {};
if (!this.state.name) {
return data;
}
data[this.state.name] = this.state.text_content || this.state.inner_html || "";
return data;
}); });
}(window, document, rJS)); }(window, document, rJS));
\ No newline at end of file
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