Commit 66ccaada authored by Boxiang Sun's avatar Boxiang Sun Committed by Eteri

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 02b89ac9
......@@ -88,12 +88,13 @@
render: true
})
.push(function () {
return gadget.getUrlParameter('field_listbox_begin_from');
})
.push(function (field_listbox_begin_from) {
return gadget.changeState({
field_listbox_begin_from: field_listbox_begin_from
});
return gadget.getDeclaredGadget("last")
.push(function (listbox) {
return listbox.render({
jio_key: gadget.property_dict.option_dict.listbox_jio_key,
view: gadget.property_dict.option_dict.listbox_gadget
});
});
})
.push(function () {
return gadget.updateHeader({
......@@ -250,21 +251,6 @@
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")) {
queue
.push(function () {
......@@ -292,12 +278,13 @@
if (last_href === undefined) {
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([
result_list[1].render({
jio_key: "support_request_module",
view: last_href
}),
gadget.renderGraph() //Launched as service, not blocking
]);
});
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.1258.50557.40021</string> </value>
<value> <string>962.5582.22272.14165</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1505136885.5</float>
<float>1505396121.35</float>
<string>UTC</string>
</tuple>
</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