Bug 38118: Display columns if not empty in drawCallback
Instead of updating only when DT init is complete we are going to update
the visibility when the table will be redrawn.
Test plan:
1 - Find/Add a bib record with no items
2 - Add 20 items from Centerville
Edit ->Edit items -> enter CENTER1 into barcode ->'Add multiple copies' -> 20
3 - Add 20 items from Fairview as above but enter 'FAIR1' for barcode and 'FAIR ITEM' as callnumber
4 - Add 1 item from Midway with barcode MIDWAY1
5 - Edit a midway patron to grant 'catalogue' and 'edit_items' permission - NOT edit_any_item
6 - Sign in as the patron above
7 - Find the record
8 - Note there is callnumber and actions/edit columns
9 - Go to page 2 of items - callnumber visible
10 - Go to page 3 - edit column
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
491ad084ba
commit
f70f31ed5d
|
|
@ -120,6 +120,24 @@
|
|||
}
|
||||
}
|
||||
|
||||
function update_columns_visibility(settings){
|
||||
let table = settings.oInstance.api();
|
||||
table.columns().visible(true);
|
||||
table.columns().every(function(i){
|
||||
let is_empty = true;
|
||||
let nodes = this.nodes();
|
||||
nodes.each((td, ii) => {
|
||||
if ( $(td).html() !== '' ) {
|
||||
is_empty = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if ( is_empty ) {
|
||||
table.columns(i).visible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$(".SelectAll").on("click",function(e){
|
||||
|
|
@ -779,20 +797,6 @@
|
|||
[% END %]
|
||||
],
|
||||
initComplete: function( settings, json ){
|
||||
let table = settings.oInstance.api();
|
||||
table.columns().every(function(i){
|
||||
let is_empty = true;
|
||||
let nodes = this.nodes();
|
||||
nodes.each((td, ii) => {
|
||||
if ( $(td).html() !== '' ) {
|
||||
is_empty = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if ( is_empty ) {
|
||||
table.columns(i).visible(false);
|
||||
}
|
||||
});
|
||||
[% IF StaffDetailItemSelection %]
|
||||
itemSelectionBuildActionLinks(tab_id);
|
||||
[% END %]
|
||||
|
|
@ -835,6 +839,8 @@
|
|||
});
|
||||
[% END %]
|
||||
|
||||
update_columns_visibility(settings);
|
||||
|
||||
if ( drawcallback ) { drawcallback(this); }
|
||||
},
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue