Commit 51f8f51a authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Use a job to render the listbox lines

parent 660050d4
/*jslint indent: 2, maxerr: 3, nomen: true */ /*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, document, rJS, URI, RSVP, loopEventListener, /*global window, document, rJS, URI, RSVP,
SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory*/ SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory*/
(function (window, document, rJS, URI, RSVP, loopEventListener, (function (window, document, rJS, URI, RSVP,
SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory) { SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory) {
"use strict"; "use strict";
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
...@@ -311,6 +311,7 @@ ...@@ -311,6 +311,7 @@
}) })
.push(function (my_html) { .push(function (my_html) {
gadget.props.element.querySelector(".thead").innerHTML = my_html; gadget.props.element.querySelector(".thead").innerHTML = my_html;
gadget.renderContent();
}); });
}) })
.declareMethod('getListboxInfo', function () { .declareMethod('getListboxInfo', function () {
...@@ -324,7 +325,7 @@ ...@@ -324,7 +325,7 @@
////////////////////////////////////////////// //////////////////////////////////////////////
// render the listbox in an asynchronous way // render the listbox in an asynchronous way
////////////////////////////////////////////// //////////////////////////////////////////////
.declareService(function () { .declareJob('renderContent', function () {
var gadget = this, var gadget = this,
props = gadget.props, props = gadget.props,
field_json = props.field_json, field_json = props.field_json,
...@@ -525,32 +526,20 @@ ...@@ -525,32 +526,20 @@
return data; return data;
}); });
}) })
.declareService(function () { .onEvent('click', function (evt) {
var gadget = this, var gadget = this,
sort_button = gadget.props.element.querySelector('button[name="Sort"]'),
hide_button = gadget.props.element.querySelector('button[name="Hide"]'),
url, url,
options = {}, options = {};
sort_button = gadget.props.element.querySelector('button[name="Sort"]'); if (evt.target === sort_button) {
return loopEventListener(
sort_button,
"click",
false,
function () {
url = "gadget_erp5_sort_editor.html"; url = "gadget_erp5_sort_editor.html";
options.sort_column_list = gadget.props.field_json.sort_column_list; options.sort_column_list = gadget.props.field_json.sort_column_list;
options.sort_list = gadget.props.sort_list; options.sort_list = gadget.props.sort_list;
options.key = gadget.props.field_json.key + "_sort_list:json"; options.key = gadget.props.field_json.key + "_sort_list:json";
return gadget.renderEditorPanel(url, options); return gadget.renderEditorPanel(url, options);
} }
); if (evt.target === hide_button) {
})
.declareService(function () {
var gadget = this,
hide_button = gadget.props.element.querySelector('button[name="Hide"]');
return loopEventListener(
hide_button,
"click",
false,
function () {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
var i, var i,
...@@ -626,8 +615,7 @@ ...@@ -626,8 +615,7 @@
}); });
}); });
} }
); }, false, false)
})
.allowPublicAcquisition("notifyInvalid", function () { .allowPublicAcquisition("notifyInvalid", function () {
return; return;
...@@ -637,5 +625,5 @@ ...@@ -637,5 +625,5 @@
return; return;
}); });
}(window, document, rJS, URI, RSVP, loopEventListener, }(window, document, rJS, URI, RSVP,
SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory)); SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory));
\ 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>954.25745.6524.38843</string> </value> <value> <string>954.28831.10592.12339</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>1475666953.92</float> <float>1475852314.74</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