Lines 123-132
Link Here
|
123 |
} |
123 |
} |
124 |
} |
124 |
} |
125 |
|
125 |
|
126 |
function update_columns_visibility(settings){ |
126 |
function update_columns_visibility(table_dt, table_settings, user_colvis){ |
127 |
let table = settings.oInstance.api(); |
127 |
table_dt.columns().visible(true, false); |
128 |
table.columns().visible(true, false); |
128 |
let hidden_ids = _dt_visibility(table_settings, table_dt); |
129 |
table.columns().every(function(){ |
129 |
table_dt.columns(hidden_ids).visible(false, false); |
|
|
130 |
table_dt.columns().every(function(){ |
130 |
let i = this.index(); |
131 |
let i = this.index(); |
131 |
let is_empty = true; |
132 |
let is_empty = true; |
132 |
let nodes = this.nodes(); |
133 |
let nodes = this.nodes(); |
Lines 137-145
Link Here
|
137 |
} |
138 |
} |
138 |
}); |
139 |
}); |
139 |
if ( is_empty ) { |
140 |
if ( is_empty ) { |
140 |
table.columns(i).visible(false, false); |
141 |
table_dt.columns(i).visible(false, false); |
141 |
} |
142 |
} |
142 |
}); |
143 |
}); |
|
|
144 |
for (const [key, value] of Object.entries(user_colvis)) { |
145 |
table_dt.columns(key).visible(value, false); |
146 |
} |
143 |
} |
147 |
} |
144 |
|
148 |
|
145 |
|
149 |
|
Lines 265-270
Link Here
|
265 |
otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], |
269 |
otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], |
266 |
}; |
270 |
}; |
267 |
|
271 |
|
|
|
272 |
let user_colvis = {holdings: {}, otherholdings: {}}; |
268 |
let table_nodes = { |
273 |
let table_nodes = { |
269 |
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", |
274 |
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", |
270 |
otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", |
275 |
otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", |
Lines 850-856
Link Here
|
850 |
[% END %] |
855 |
[% END %] |
851 |
|
856 |
|
852 |
if ( api.data().length ) { |
857 |
if ( api.data().length ) { |
853 |
update_columns_visibility(settings); |
858 |
update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); |
854 |
} |
859 |
} |
855 |
|
860 |
|
856 |
if ( drawcallback ) { drawcallback(this); } |
861 |
if ( drawcallback ) { drawcallback(this); } |
Lines 863-868
Link Here
|
863 |
filters_options, |
868 |
filters_options, |
864 |
); |
869 |
); |
865 |
|
870 |
|
|
|
871 |
let table_dt = items_table.DataTable(); |
872 |
table_dt.on("column-visibility.dt", function(e, settings, column, state, recalc ){ |
873 |
if (recalc === false) return; |
874 |
|
875 |
_dt_add_filters(this, table_dt, filters_options); |
876 |
|
877 |
user_colvis[tab_id][column] = state; |
878 |
|
879 |
}); |
866 |
return items_table; |
880 |
return items_table; |
867 |
} |
881 |
} |
868 |
function safe_link(uri,link_text) { |
882 |
function safe_link(uri,link_text) { |
869 |
- |
|
|