Commit 880fd080 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui: Fix code to select the first element if only one

Also, remove the usage of document.getElementById because we should search only inside the current gadget
parent b137d8eb
......@@ -52,12 +52,12 @@
return gadget.jio_getAttachment(
'support_request_module',
gadget.hateoas_url + 'support_request_module'
+ "/SupportRequest_getSupportTypeList"
+ "?project_id=" + evt.target.value + "&json_flag=True"
gadget.hateoas_url + 'support_request_module' +
"/SupportRequest_getSupportTypeList" +
"?project_id=" + evt.target.value + "&json_flag=True"
).push(function (sp_list) {
var i, j,
sp_select = document.getElementById('field_your_resource');
sp_select = gadget.element.querySelector('#field_your_resource');
for (i = sp_select.options.length - 1; i >= 0; i -= 1) {
sp_select.remove(i);
}
......@@ -65,6 +65,9 @@
for (j = 0; j < sp_list.length; j += 1) {
sp_select.options[j] = new Option(sp_list[j][0], sp_list[j][1]);
}
if (sp_select.options.length === 2) {
sp_select.selectedIndex = 1;
}
});
}
}, false, false);
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.26853.29747.36369</string> </value>
<value> <string>983.16474.54324.46062</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,8 +260,8 @@
</tuple>
<state>
<tuple>
<float>1540524000.73</float>
<string>GMT+9</string>
<float>1587070526.38</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
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