diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html index 4b09d954e6e2424f508e1d1a3b6328ffe5dea99f..963d3de821930ffe32e2d90a43f0c9da1d56d6d2 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html @@ -20,7 +20,7 @@ <!-- custom script --> <script src="gadget_erp5_field_listbox.js" type="text/javascript"></script> - <script id="listbox-thead-template" type="text/x-handlebars-template"> + <script id="listbox-hidden-thead-template" type="text/x-handlebars-template"> <table> <thead class="ui-bar-inherit head"> <tr> @@ -42,6 +42,25 @@ </table> </script> + <script id="listbox-show-thead-template" type="text/x-handlebars-template"> + <table> + <thead class="ui-bar-inherit head"> + <tr> + {{#if show_anchor}} + <th data-i18n="Jump">Jump</th> + {{/if}} + <th></th> + {{#each head_value}} + <th data-i18n="{{data-i18n}}" class="{{class_value}}">{{text}}</th> + {{/each}} + {{#if line_icon}} + <th></th> + {{/if}} + </tr> + </thead> + </table> + </script> + <script id="listbox-hidden-tbody-template" type="text/x-handlebars-template"> <table> <tbody class="tbody"> diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js index de9d9f0e002f24d06291de1b81fc852afd8d5f8c..3faef4dc60b00f3e863a663b55925f954fba183f 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js @@ -5,10 +5,14 @@ SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory) { "use strict"; var gadget_klass = rJS(window), - listbox_thead_source = gadget_klass.__template_element - .getElementById("listbox-thead-template") + listbox_hidden_thead_source = gadget_klass.__template_element + .getElementById("listbox-hidden-thead-template") .innerHTML, - listbox_thead_template = Handlebars.compile(listbox_thead_source), + listbox_hidden_thead_template = Handlebars.compile(listbox_hidden_thead_source), + listbox_show_thead_source = gadget_klass.__template_element + .getElementById("listbox-show-thead-template") + .innerHTML, + listbox_show_thead_template = Handlebars.compile(listbox_show_thead_source), listbox_hidden_tbody_source = gadget_klass.__template_element .getElementById("listbox-hidden-tbody-template") @@ -348,7 +352,8 @@ .push(function (column_sort_link_list) { // here we obtain links for sorting by columns // so we can construct array of header objects to be rendered in the header template - var hide_button_text, + var listbox_thead_template, + hide_button_text, hide_button_name, head_value_list = column_list.map(function (column, index) { var current_sort = sort_list.find(hasSameFirstItem(column)), @@ -372,9 +377,11 @@ }); if (gadget.state.show_line_selector) { + listbox_thead_template = listbox_show_thead_template; hide_button_text = 'Submit'; hide_button_name = 'SelectRows'; } else { + listbox_thead_template = listbox_hidden_thead_template; hide_button_text = 'Hide Rows'; hide_button_name = 'Hide'; } diff --git a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testHideItem.zpt b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testHideItem.zpt index b69a0a8c451871cb6a35214d6420de71ca3605fe..0606092e083e397c79901c13fe686416d3baa124 100644 --- a/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testHideItem.zpt +++ b/bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testHideItem.zpt @@ -45,8 +45,6 @@ </tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> -<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/clear_query" /> - <tr> <td>waitForElementPresent</td> @@ -98,6 +96,7 @@ <td></td> </tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /> <tr> <td>waitForElementPresent</td> @@ -113,11 +112,30 @@ <td></td> </tr> +<!-- Check the listbox column header --> +<tr> + <td>assertText</td> + <td>//thead/tr/th[1]</td> + <td>ID</td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[2]</td> + <td>Title</td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[3]</td> + <td>Quantity</td> +</tr> + + <tr> <td>click</td> <td>//button[@data-i18n='Hide Rows']</td> <td></td> </tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" /> <tr> <td>waitForElementPresent</td> @@ -125,6 +143,30 @@ <td></td> </tr> +<!-- Check the listbox column header --> +<tr> + <td>assertText</td> + <td>//thead/tr/th[1]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[2]</td> + <td>ID</td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[3]</td> + <td>Title</td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[4]</td> + <td>Quantity</td> +</tr> + +<!-- Line checkbox --> + <tr> <td>verifyValue</td> <td>//tbody/tr/td/input[@type="checkbox"]</td> @@ -165,6 +207,23 @@ <td></td> </tr> +<!-- Check the listbox column header --> +<tr> + <td>assertText</td> + <td>//thead/tr/th[1]</td> + <td>ID</td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[2]</td> + <td>Title</td> +</tr> +<tr> + <td>assertText</td> + <td>//thead/tr/th[3]</td> + <td>Quantity</td> +</tr> + <!-- only one element present --> <tr> <td>verifyElementPresent</td> @@ -191,6 +250,7 @@ <td>//button[@data-i18n='Hide Rows']</td> <td></td> </tr> +<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" /> <tr> <td>waitForElementPresent</td>