Commit 14cac0bc authored by Boxiang Sun's avatar Boxiang Sun Committed by Tristan Cavelier

erp5_officejs_support_request_ui: Fix the listbox always loading problem.

When the homepage refreshed with "field_listbox_begin_from", the
listbox always on loading state.

We should not call child gadget's "changeState" directly. Instead,
we need to call child(listbox) render in parent render.

Which can let the child listbox aware of the parameter change in the parent gadget.
parent dfd37887
...@@ -88,12 +88,13 @@ ...@@ -88,12 +88,13 @@
render: true render: true
}) })
.push(function () { .push(function () {
return gadget.getUrlParameter('field_listbox_begin_from'); return gadget.getDeclaredGadget("last")
}) .push(function (listbox) {
.push(function (field_listbox_begin_from) { return listbox.render({
return gadget.changeState({ jio_key: gadget.property_dict.option_dict.listbox_jio_key,
field_listbox_begin_from: field_listbox_begin_from view: gadget.property_dict.option_dict.listbox_gadget
}); });
});
}) })
.push(function () { .push(function () {
return gadget.updateHeader({ return gadget.updateHeader({
...@@ -250,21 +251,6 @@ ...@@ -250,21 +251,6 @@
return erp5_form.changeState({erp5_form: JSON.stringify(tmp)}); return erp5_form.changeState({erp5_form: JSON.stringify(tmp)});
}); });
} }
if (modification_dict.hasOwnProperty("field_listbox_begin_from")) {
// render the erp5 form
queue
.push(function () {
return gadget.getDeclaredGadget("last");
})
.push(function (result_list) {
var erp5_form = result_list,
tmp;
tmp = JSON.parse(erp5_form.state.erp5_form);
tmp.field_listbox_begin_from = modification_dict.field_listbox_begin_from;
return erp5_form.changeState({erp5_form: JSON.stringify(tmp)});
});
}
if (modification_dict.hasOwnProperty("render")) { if (modification_dict.hasOwnProperty("render")) {
queue queue
.push(function () { .push(function () {
...@@ -292,12 +278,13 @@ ...@@ -292,12 +278,13 @@
if (last_href === undefined) { if (last_href === undefined) {
throw new Error('Cant find the list document view'); throw new Error('Cant find the list document view');
} }
gadget.property_dict.option_dict = {graph_gadget: "unsafe/gadget_field_graph_echarts.html"}; gadget.property_dict.option_dict = {
graph_gadget: "unsafe/gadget_field_graph_echarts.html",
listbox_gadget: last_href,
listbox_jio_key: "support_request_module"
};
return RSVP.all([ return RSVP.all([
result_list[1].render({
jio_key: "support_request_module",
view: last_href
}),
gadget.renderGraph() //Launched as service, not blocking gadget.renderGraph() //Launched as service, not blocking
]); ]);
}); });
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.1258.50557.40021</string> </value> <value> <string>962.5582.22272.14165</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1505136885.5</float> <float>1505396121.35</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