Hi folks,
I'm using jQuery's Tablesorter v-2.31.3.
So essentially, I have a large table that doesn't quite fit nicely on mobile devices (too much columns of data). I've decided to hide columns using a CSS class I created "hideme" :
- <style>
- /* CSS Specific for phones, tablets, etc. */
- @media only screen and (max-width: 767.98px){
- .hidemeOnPhones {
- display: none;
- }
- }
- </style>
I've added class="hidemeOnPhones" to all of my table's TD's and TH's I don't want showing up when viewing the page on smartphones...
That works as planned.HOWEVER, my page is still somewhat broken. For one thing, it seems like the filter boxes for all columns I've hidden still exists, as if the tablesorter still counted them in... I get this:
So, I also tried appending this 'hidemeOnPhones' class to my last 4 columns in my filter_cssFilter:
- filter_cssFilter: [
- 'form-control form-control-sm',
- 'form-control form-control-sm',
- 'custom-select custom-select-sm',
- 'form-control form-control-sm',
- 'form-control form-control-sm',
- 'form-control form-control-sm hidemeOnPhones',
- 'form-control form-control-sm hidemeOnPhones',
- 'form-control form-control-sm hidemeOnPhones',
- 'form-control form-control-sm hidemeOnPhones'
- ],
Now, I get this:
The filter's last 4 input boxes don't show up, but still, I have a spanning problem here...
Yet, I don't think putting 'hidemeOnPhones' on my last 4 entries of filter_cssFilter is the best thing...
Note that I'm also using the tablersorter.Pager. And, this pager is on the table's footer:
- <tfoot>
- <tr>
- <th colspan="100%" class="ts-pager">
- ....
- </th>
- </tr>
- </tfoot>
I've noticed that if I force my pager's row with a colspan="5" (number of columns shown in phones), then it's perfect:
I've tried to also add a custom CSS class in my pager's cell that would take care of changing colspan, but whatever I found doesn't change my colspan at all, regardless which browsers...
- <style>
- @media only screen and (max-width: 767.98px){
- .setPagerColSpan {
- column-span: 3; /* W3C */
- -webkit-column-span: 3; /* Safari & Chrome */
- -moz-column-span: 3; /* Firefox */
- -ms-column-span: 3; /* Internet Explorer */
- -o-column-span: 3; /* Opera */
- }
- }
- </style>
So, wondering if there's a way I could do this properly with what tablesorter has to offer?
Thanks for you time and help!
Cheers. Pat