Commit d5946433 authored by Boxiang Sun's avatar Boxiang Sun Committed by Eteri

erp5_officejs_support_request_ui: Restore button fixing.

Solved issues:
- Restore button didn't work after change listbox.changeState to listbox.render.
- Restore button should restore the listbox to page zero.
- Restore button should be enabled when to refresh the page with expected parameters.
parent 67170e08
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
return gadget.getSearchCriteria(params[0][0], params[0][1]) return gadget.getSearchCriteria(params[0][0], params[0][1])
.push(function (result) { .push(function (result) {
return gadget.redirect({command: 'change', options: {extended_search: result}}); return gadget.redirect({command: 'change', options: {extended_search: result,
field_listbox_begin_from: undefined}});
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
if (error instanceof RSVP.CancellationError) { if (error instanceof RSVP.CancellationError) {
...@@ -233,6 +234,16 @@ ...@@ -233,6 +234,16 @@
}); });
}); });
}) })
.declareJob("renderRestoreButton", function () {
var gadget = this,
restore = document.getElementById('restoreButton');
return gadget.getUrlParameter('extended_search')
.push(function (result) {
if (result !== undefined) {
restore.removeAttribute("disabled");
}
});
})
.onStateChange(function () { .onStateChange(function () {
var gadget = this, var gadget = this,
queue = new RSVP.Queue(); queue = new RSVP.Queue();
...@@ -264,6 +275,7 @@ ...@@ -264,6 +275,7 @@
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 = { gadget.property_dict.option_dict = {
graph_gadget: "unsafe/gadget_field_graph_echarts.html", graph_gadget: "unsafe/gadget_field_graph_echarts.html",
listbox_gadget: last_href, listbox_gadget: last_href,
...@@ -273,6 +285,7 @@ ...@@ -273,6 +285,7 @@
return RSVP.all([ return RSVP.all([
result_list[1].render(), result_list[1].render(),
gadget.renderRestoreButton(),
gadget.renderGraph() //Launched as service, not blocking gadget.renderGraph() //Launched as service, not blocking
]); ]);
}); });
...@@ -312,14 +325,8 @@ ...@@ -312,14 +325,8 @@
if (event.target.id === "restoreButton") { if (event.target.id === "restoreButton") {
restore.setAttribute("disabled", "disabled"); restore.setAttribute("disabled", "disabled");
return gadget.getDeclaredGadget("last") return gadget.redirect({command: 'change', options: {extended_search: undefined,
.push(function (listbox) { field_listbox_begin_from: undefined}});
return listbox.render({
jio_key: gadget.property_dict.option_dict.listbox_jio_key,
view: gadget.property_dict.option_dict.listbox_gadget,
extended_search: null
});
});
} }
if (event.target.id === "generateRSS") { if (event.target.id === "generateRSS") {
...@@ -376,4 +383,4 @@ ...@@ -376,4 +383,4 @@
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP));
\ No newline at end of file
...@@ -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.23501.9134.29371</string> </value> <value> <string>962.25742.4974.61781</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>1506471192.27</float> <float>1506605728.66</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