Lines 664-676
function _dt_buttons(params){
Link Here
|
664 |
} |
664 |
} |
665 |
); |
665 |
); |
666 |
|
666 |
|
667 |
let included_columns = table_settings.columns.filter(c => !c.cannot_be_toggled); |
667 |
// Retrieving bKohaColumnsUseNames from the options passed to the constructor, not DT's settings |
|
|
668 |
// But ideally should be retrieved using table.data() |
669 |
let use_names = settings.bKohaColumnsUseNames; |
670 |
let included_columns = []; |
671 |
if ( use_names ) { |
672 |
// bKohaColumnsUseNames is set, identify columns by their data-colname |
673 |
included_columns = table_settings.columns.filter(c => !c.cannot_be_toggled).map(c => "[data-colname='%s']".format(c.columnname)).join(','); |
674 |
} else { |
675 |
// Not set, columns are ordered the same than in the columns settings |
676 |
included_columns = table_settings.columns.map((c, i) => !c.cannot_be_toggled ? i : null).filter(i => i !== null); |
677 |
} |
668 |
if( included_columns.length > 0 ){ |
678 |
if( included_columns.length > 0 ){ |
669 |
buttons.push( |
679 |
buttons.push( |
670 |
{ |
680 |
{ |
671 |
extend: 'colvis', |
681 |
extend: 'colvis', |
672 |
fade: 100, |
682 |
fade: 100, |
673 |
columns: included_columns.map(c => "[data-colname='%s']".format(c.columnname)).join(','), |
683 |
columns: included_columns, |
674 |
className: "columns_controls", |
684 |
className: "columns_controls", |
675 |
titleAttr: __("Columns settings"), |
685 |
titleAttr: __("Columns settings"), |
676 |
text: '<i class="fa fa-lg fa-gear"></i> <span class="dt-button-text">' + __("Columns") + '</span>', |
686 |
text: '<i class="fa fa-lg fa-gear"></i> <span class="dt-button-text">' + __("Columns") + '</span>', |
677 |
- |
|
|