Commit 0455cdc6 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Listbox: send checked line's uid list

parent e841ef41
......@@ -1256,6 +1256,20 @@
return queue
.push(function () {
data[form_gadget.props.listbox_uid_dict.key] = form_gadget.props.listbox_uid_dict.value;
// Send the list of checked uids
var checked_uid_list = [],
all_hide_element_list = form_gadget.element.querySelectorAll(".hide_element"),
i;
for (i = 0; i < all_hide_element_list.length; i += 1) {
if (all_hide_element_list[i].checked) {
checked_uid_list.push(all_hide_element_list[i].getAttribute("data-uid"));
}
}
if (checked_uid_list.length) {
data['uids:list'] = checked_uid_list;
  • Hi. I realized that my private patch for listbox is very similar to this commit, but I found one difference here. In my case I use form_gadget.props.listbox_uid_dict.key instead of uid:list. Could you tell me why uid:list is used here? Is it because uid:list is compatible with xhtml style?

  • Yes, this was introduce for compatibility with existing actions, more specifically for the accounting grouping reference action.

  • Thank you for your answer. May I ask one more thing? I would like to know what getContentmethod of field gadget should be, its expected job in ERP5JS. Since I was not sure what getContent should be, I was not able to commit my patch. I thought that my change may be wrong because getContent may be expected as to return all choices, not selected ones only.

  • getContent generates a dictionnary of key/value items expected by the ERP5 Field validator in the REQUEST.

    So, the keys really depends on every field implementation.

    For the listbox, I'm not aware of any official expected list of keys. So, it is a matter of improving the compatibility of existing actions + adding tests.

Please register or sign in to reply
}
if (form_gadget.props.listbox_query_param_json !== undefined) {
// JSON query parameters are only sent when rendering an ERP5 Form
data[form_gadget.props.listbox_query_param_json.key] =
......
......@@ -154,11 +154,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -202,16 +204,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -234,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>978.63078.12405.1024</string> </value>
<value> <string>979.27738.39874.9932</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1570723719.08</float>
<float>1572276942.85</float>
<string>UTC</string>
</tuple>
</state>
......@@ -261,16 +267,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -318,7 +328,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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