Commit e841ef41 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Listbox: handle not simple uid value

parent b446323a
...@@ -7,6 +7,28 @@ ...@@ -7,6 +7,28 @@
loading_class_list = ['ui-icon-spinner', 'ui-btn-icon-left'], loading_class_list = ['ui-icon-spinner', 'ui-btn-icon-left'],
disabled_class = 'ui-disabled'; disabled_class = 'ui-disabled';
function buildFieldGadgetParam(value) {
var field_gadget_param;
if ((value !== undefined) && (value !== null) && (value.constructor === Object)) {
if (value.field_gadget_param) {
field_gadget_param = value.field_gadget_param;
} else {
field_gadget_param = {
'editable': 0,
'default': value.default
};
}
} else {
field_gadget_param = {
'editable': 0,
'default': value
};
}
return field_gadget_param;
}
function listbox_tbody_template(options) { function listbox_tbody_template(options) {
/* /*
<tbody> <tbody>
...@@ -897,7 +919,7 @@ ...@@ -897,7 +919,7 @@
command: gadget.state.command, command: gadget.state.command,
options: { options: {
jio_key: allDocs_result.data.rows[i].id, jio_key: allDocs_result.data.rows[i].id,
uid: allDocs_result.data.rows[i].value.uid, uid: buildFieldGadgetParam(allDocs_result.data.rows[i].value.uid).default,
selection_index: gadget.state.begin_from + i, selection_index: gadget.state.begin_from + i,
query: gadget.state.query_string, query: gadget.state.query_string,
list_method_template: gadget.state.list_method_template, list_method_template: gadget.state.list_method_template,
...@@ -953,22 +975,8 @@ ...@@ -953,22 +975,8 @@
// value accordingly. value can be simply just a value in // value accordingly. value can be simply just a value in
// case of non-editable field thus we construct "field_json" // case of non-editable field thus we construct "field_json"
// manually and insert the value in "default" // manually and insert the value in "default"
value = buildFieldGadgetParam(value);
if (value.constructor === Object) {
if (value.field_gadget_param) {
value = value.field_gadget_param;
} else {
value = {
'editable': 0,
'default': value.default
};
}
} else {
value = {
'editable': 0,
'default': value
};
}
value.href = url_value; value.href = url_value;
value.editable = value.editable && gadget.state.editable; value.editable = value.editable && gadget.state.editable;
value.line = i; value.line = i;
...@@ -986,7 +994,7 @@ ...@@ -986,7 +994,7 @@
cell_list.forEach(setNonEditable); cell_list.forEach(setNonEditable);
} }
row_list.push({ row_list.push({
"uid": allDocs_result.data.rows[i].value.uid, "uid": buildFieldGadgetParam(allDocs_result.data.rows[i].value.uid).default,
"jump": line_link_list[i], "jump": line_link_list[i],
"cell_list": cell_list, "cell_list": cell_list,
"line_icon": gadget.state.line_icon "line_icon": gadget.state.line_icon
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>978.14035.65281.57804</string> </value> <value> <string>978.63078.12405.1024</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1567608261.37</float> <float>1570723719.08</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