| 
      
            Lines 170-182
          function KohaTable(id_selector, dt_parameters, table_settings, add_filters, defa
      
      
        Link Here
      
     | 
  
        
          | 170 | 
           | 
          170 | 
           | 
        
        
          | 171 | 
              dt_parameters[ "buttons" ] = ['clear_filter'];  | 
          171 | 
              dt_parameters[ "buttons" ] = ['clear_filter'];  | 
        
        
          | 172 | 
           | 
          172 | 
           | 
        
          
            
              | 173 | 
                  let included_columns = table_settings.columns.filter(c => !c.cannot_be_toggled);  | 
              173 | 
                  // Retrieving bKohaColumnsUseNames from the options passed to the constructor, not DT settings  | 
            
            
               | 
               | 
              174 | 
                  // But ideally should be retrieved using table.data()  | 
            
            
              | 175 | 
                  let use_names = dt_parameters.bKohaColumnsUseNames;  | 
            
            
              | 176 | 
                  let included_columns = [];  | 
            
            
              | 177 | 
                  if (table_settings) { | 
            
            
              | 178 | 
                      if (use_names) { | 
            
            
              | 179 | 
                          // bKohaColumnsUseNames is set, identify columns by their data-colname  | 
            
            
              | 180 | 
                          included_columns = table_settings.columns  | 
            
            
              | 181 | 
                              .filter(c => !c.cannot_be_toggled)  | 
            
            
              | 182 | 
                              .map(c => "[data-colname='%s']".format(c.columnname))  | 
            
            
              | 183 | 
                              .join(","); | 
            
            
              | 184 | 
                      } else { | 
            
            
              | 185 | 
                          // Not set, columns are ordered the same than in the columns settings  | 
            
            
              | 186 | 
                          included_columns = table_settings.columns  | 
            
            
              | 187 | 
                              .map((c, i) => (!c.cannot_be_toggled ? i : null))  | 
            
            
              | 188 | 
                              .filter(i => i !== null);  | 
            
            
              | 189 | 
                      }  | 
            
            
              | 190 | 
                  }  | 
            
            
              | 191 | 
               | 
            
        
          | 174 | 
              if( included_columns.length > 0 ){ | 
          192 | 
              if( included_columns.length > 0 ){ | 
        
        
          | 175 | 
                  dt_parameters[ "buttons" ].push(  | 
          193 | 
                  dt_parameters[ "buttons" ].push(  | 
        
        
          | 176 | 
                      { | 
          194 | 
                      { | 
        
        
          | 177 | 
                          extend: 'colvis',  | 
          195 | 
                          extend: 'colvis',  | 
        
        
          | 178 | 
                          fade: 100,  | 
          196 | 
                          fade: 100,  | 
        
          
            
              | 179 | 
                              columns: included_columns.map(c => "[data-colname='%s']".format(c.columnname)).join(','), | 
              197 | 
                              columns: included_columns,  | 
            
        
          | 180 | 
                          className: "columns_controls",  | 
          198 | 
                          className: "columns_controls",  | 
        
        
          | 181 | 
                          titleAttr: _("Columns settings"), | 
          199 | 
                          titleAttr: _("Columns settings"), | 
        
        
          | 182 | 
                          text: '<i class="fa fa-lg fa-gear"></i> <span class="dt-button-text">' + _("Columns") + '</span>', | 
          200 | 
                          text: '<i class="fa fa-lg fa-gear"></i> <span class="dt-button-text">' + _("Columns") + '</span>', | 
        
            
              | 183 | 
              -   | 
               | 
               |