View | Details | Raw Unified | Return to bug 38978
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-7 / +12 lines)
Lines 120-129 Link Here
120
            }
120
            }
121
        }
121
        }
122
122
123
        function update_columns_visibility(settings){
123
        function update_columns_visibility(table_dt, table_settings) {
124
            let table = settings.oInstance.api();
124
            table_dt.columns().visible(true);
125
            table.columns().visible(true);
125
            const hidden_ids = _dt_visibility(table_settings, table_dt);
126
            table.columns().every(function(i){
126
127
            table_dt.columns().every(function(i){
127
                let is_empty = true;
128
                let is_empty = true;
128
                let nodes = this.nodes();
129
                let nodes = this.nodes();
129
                nodes.each((td, ii) => {
130
                nodes.each((td, ii) => {
Lines 132-139 Link Here
132
                        return;
133
                        return;
133
                    }
134
                    }
134
                });
135
                });
136
                if (hidden_ids && Array.isArray(hidden_ids) && hidden_ids[0]) {
137
                    hidden_ids[0].forEach((colIndex) => {
138
                        table_dt.columns(colIndex).visible(false);
139
                    });
140
                }
135
                if ( is_empty ) {
141
                if ( is_empty ) {
136
                    table.columns(i).visible(false);
142
                    table_dt.columns(i).visible(false);
137
                }
143
                }
138
            });
144
            });
139
        }
145
        }
Lines 836-842 Link Here
836
                [% END %]
842
                [% END %]
837
843
838
                if ( api.data().length ) {
844
                if ( api.data().length ) {
839
                    update_columns_visibility(settings);
845
                    update_columns_visibility(api, items_table_settings[tab_id]);
840
                }
846
                }
841
847
842
                if ( drawcallback ) { drawcallback(this); }
848
                if ( drawcallback ) { drawcallback(this); }
843
- 

Return to bug 38978