Mottie / tablesorter

Github fork of Christian Bach's tablesorter plugin + awesomeness ~
https://mottie.github.io/tablesorter/docs/
2.61k stars 754 forks source link

Print Widget + Bootstrap column selector not working properly #1623

Open Hellogark opened 5 years ago

Hellogark commented 5 years ago

Hi mottie, as the title says i'm using the print widget and Bootstrap column selector, when Auto checkbox is selected the preview shows all columns and not the "data-priority" critical ones. The html for the button is the same as the example in docs. This is the config i'm running

columnSelector_name  : 'data-selector-name',
      columnSelector_columns : {
        0: 'disable' /* set to disabled; not allowed to unselect it */
      },
      columnSelector_layout : '<label><input type="checkbox">{name}</label>',   
      columnSelector_layoutCustomizer : null,    
      columnSelector_mediaquery: true,    
      columnSelector_mediaqueryName: 'Auto: ',    
      columnSelector_mediaqueryState: true,   
      columnSelector_mediaqueryHidden: false,      
      columnSelector_maxVisible: null,
      columnSelector_minVisible: null,     
      columnSelector_breakpoints :false,    
      columnSelector_priority : 'data-priority',    
      columnSelector_cssChecked : 'checked',

      print_title      : 'Report',         
      print_dataAttrib : 'data-name', 
      print_rows       : 'v',         
      print_columns    : 's',       
      print_extraCSS   : '',              
      print_now        : false,              
      print_callback   : function(config, $table, printStyle) {      
        $.tablesorter.printTable.printOutput( config, $table.html(), printStyle );
      },

With print_columns 's' i have to uncheck all checkboxes including Auto to get the table printed correctly. It's curious but, print_columns 'v' it's supouse to take only visible columns wich i only have 5 visible when none of the other checkboxes are selected or auto is selected, but it still printing all columns.print_columns 's' With Auto checkbox checked example report

Mottie commented 5 years ago

Hi @Hellogark!

It looks like you're using a custom theme. Please make sure you've included the following definition:

.tablesorter .filtered {
  display: none;
}

If that doesn't solve the problem, please modify this demo to show the issue.

Hellogark commented 5 years ago

I'm using bootstrap v4 theme, it's not a custom one but i'll add that code to my main css to see if it works

Hellogark commented 5 years ago

@Mottie Here is the fiddle, https://jsfiddle.net/Hellogark/cLn8g32y/3/ Select auto and click print, it seems it is not only the bootstrap column selector, idk if something in the print config is wrong

Mottie commented 5 years ago

Oh, I understand now. You're seeing the expected behavior. If the column selector is set to auto, you may only be seeing a few columns on your tablet or phone, but when you print you'll see all the columns. It's only when you specifically hide a column that it won't print.

Hellogark commented 5 years ago

But print_column "v" it's supposed to print all visible columns and it is assumed that when selecting auto it should print only those visible columns

Mottie commented 5 years ago

The columns become all visible in the popup window. I'll take a look at it this weekend to see if I can get it to behave as you mentioned.