Commit a87fdc00 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Multilistfield: support item list without empty value

parent f0fd3841
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
rJS(window) rJS(window)
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var field_json = options.field_json || {}, var field_json = options.field_json || {},
item_list = field_json.items,
state_dict = { state_dict = {
value_list: JSON.stringify(field_json.value || value_list: JSON.stringify(field_json.value ||
field_json.default || []), field_json.default || []),
item_list: JSON.stringify(field_json.items),
editable: field_json.editable, editable: field_json.editable,
required: field_json.required, required: field_json.required,
name: field_json.key, name: field_json.key,
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
sub_select_key: field_json.sub_select_key, sub_select_key: field_json.sub_select_key,
sub_input_key: field_json.sub_input_key sub_input_key: field_json.sub_input_key
}; };
if ((item_list.length === 0) || (item_list[0][0] !== "")) {
item_list.unshift(["", ""]);
}
state_dict.item_list = JSON.stringify(item_list);
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.38943.62606.2730</string> </value> <value> <string>954.38966.23297.54869</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>1476458904.36</float> <float>1476460241.48</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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