If a library makes a change to a table's default columns settings and marks all table columns 'Cannot be toggled,' the columns button in the interface will show an empty menu. If no columns can be changed the button shouldn't appear.
Created attachment 92818 [details] [review] Bug 23612: If no columns in a table can be toggled, don't show columns button This patch makes a change to the JavaScript setup for DataTables button controls so that if there are no toggle-able buttons (or there is no columns configuration at all) the column selection menu button will not appear. To test, apply the patch and go to Administration -> Columns settings. - In the Administration section, find the section for the "libraries" table. - In the "Cannot be toggled" column, check all the checkboxes. - Save. - Go to Administration -> Libraries. - At the top of the table there should be no "Columns" button, only "Clear filter" and "Export" buttons.
Created attachment 92865 [details] [review] Works well with all DataTables I tested. Bug 23612: If no columns in a table can be toggled, don't show columns button This patch makes a change to the JavaScript setup for DataTables button controls so that if there are no toggle-able buttons (or there is no columns configuration at all) the column selection menu button will not appear. To test, apply the patch and go to Administration -> Columns settings. - In the Administration section, find the section for the "libraries" table. - In the "Cannot be toggled" column, check all the checkboxes. - Save. - Go to Administration -> Libraries. - At the top of the table there should be no "Columns" button, only "Clear filter" and "Export" buttons. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 93457 [details] [review] Bug 23612: If no columns in a table can be toggled, don't show columns button This patch makes a change to the JavaScript setup for DataTables button controls so that if there are no toggle-able buttons (or there is no columns configuration at all) the column selection menu button will not appear. To test, apply the patch and go to Administration -> Columns settings. - In the Administration section, find the section for the "libraries" table. - In the "Cannot be toggled" column, check all the checkboxes. - Save. - Go to Administration -> Libraries. - At the top of the table there should be no "Columns" button, only "Clear filter" and "Export" buttons. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Nice work! Pushed to master for 19.11.00
Created attachment 93787 [details] [review] Bug 23612: (RM follow-up) Fix failing tests Trailing comma's were causing hidden javascript errors during selenium tests. Error was identified by adding a $s->capture($driver) line to the relevant selenium test and using the following JS snippet to dump errors to the screen. (function () { var ul = null; function createErrorList() { ul = document.createElement('ul'); ul.setAttribute('id', 'js_error_list'); //ul.style.display = 'none'; document.body.appendChild(ul); } window.onerror = function(msg){ if (ul === null) createErrorList(); var li = document.createElement("li"); li.appendChild(document.createTextNode(msg)); ul.appendChild(li); }; })(); Which clearly showed the following error. ReferenceError: KohaTable is not defined Removing the trailing comma's introduced in this bug resolved the issue. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>