Bug 22175: (follow-up) Identify columns to exclude from export

Bug 21216 added a way to designate DataTables columns to include in
export operations (Copy, CSV, print, etc). However, this solution did
not take hidden columns into account. This patch revises the global
columns configuration settings so that exports will include only visible
columns and will exclude columns with a "noExport" class on the <th>.

To test, apply the patch and clear your browser cache if necessary.

 - Go to Tools -> Stock rotation
 - In the table of rotas, hide some columns in the table and verify that
   export operations include only your visible selections, excluding the
   last column with buttons.
 - Choose a rota and select Manage -> Items. Test that this table works
   in the same way.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2019-04-11 18:49:13 +00:00 committed by Nick Clemens
parent 8bf043b94d
commit 729987f40d
3 changed files with 4 additions and 6 deletions

View File

@ -21,7 +21,7 @@ function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) {
counter++;
});
var exportColumns = ":visible";
var exportColumns = ":visible:not(.noExport)";
if( dt_parameters.hasOwnProperty("exportColumns") ){
// A custom buttons configuration has been passed from the page
exportColumns = dt_parameters["exportColumns"];

View File

@ -64,7 +64,7 @@
<th>Active</th>
<th>Description</th>
<th>Number of items</th>
<th class="NoSort">&nbsp;</th>
<th class="NoSort noExport">&nbsp;</th>
</tr>
</thead>
<tbody>
@ -372,8 +372,8 @@
<th>Author</th>
<th>Call number</th>
<th class="NoSearch">In transit</th>
<th class="NoSort">Stages &amp; duration in days<br>(current stage highlighted)</th>
<th class="NoSort">&nbsp;</th>
<th class="NoSort noExport">Stages &amp; duration in days<br>(current stage highlighted)</th>
<th class="NoSort noExport">&nbsp;</th>
</tr>
</thead>
<tbody>

View File

@ -72,7 +72,6 @@ $(document).ready(function() {
],
"sPaginationType": "four_button",
"autoWidth": false,
"exportColumns": [0,1,2,3,4,5]
}, stock_rotation_items_columns_settings);
KohaTable("stock_rotation", {
@ -82,7 +81,6 @@ $(document).ready(function() {
],
"sPaginationType": "four_button",
"autoWidth": false,
"exportColumns": [0,1,2,3,4]
}, stock_rotation_columns_settings);
});