Don't be so sure now... I'm still a rookie when it comes to jQuery. After playing with the code a bit, I realized I can't even logically fathom how to go about making this work for multiple tables/classes, thus I've got what you can call a writer's block when it comes to putting it into code - I can't see it visually to start off with...
What's funny enough (and a bit frustrating too) is that if I have multiple tables with "tablesorter" and "multiple" class assigned to them show up on the page in different tabs (if I plug in the tabbed viewing of sorts), if any of these tables have different number of columns and some of those are defined inline as non-sortable (just added a class {sorter: false} as per instructions in tablesorter docs), that limitation seems to apply to all tables with tablesorter class across the board, and when I try to multi-sort on say column 2 on tables 2 & 3 (bound together with the code above), if table 1 had sorter:false on that column, table 3 doesn't get sorted on that column either - only the original table 2 does. Something I need to work around, or maybe, possibly declare different classes for each table and apply tablesorter() on them individually... maybe. On Aug 5, 5:18 pm, aquaone <aqua...@gmail.com> wrote: > I'm sure you can look at the code and find a way to get it working in the > general case. What's there was just kinda a quick and dirty hack I wrote for > another guy a while ago. I'll leave it as an exercise for the reader though. > ;-) > > aquaone > > > > On Wed, Aug 5, 2009 at 14:16, Crazy Serb <crazys...@gmail.com> wrote: > > > A-ha! > > > That's pretty much what I'd need... > > > Now, is there any slick way of repeating that over and over for > > different tables (with class names of "multisort1", "multisort2", etc) > > in case I have a few of these multi-sort tables on the same page and > > need to keep them separate? > > > Or would I pretty much have to rewrite that logic and change the class > > name(s) to the new table's class name every time? > > > Just out of curiosity... > > > Thanks again! > > > On Aug 4, 5:02 pm, aquaone <aqua...@gmail.com> wrote: > > > Tablesorter doesn't support that. You could do it as separate tables with > > no > > > gaps between them... but that's as close as you'll get. If you need > > linked > > > sorting, e.g. clicking the header of one table sorts all tables, you'll > > need > > > something like this: > > > > <script type='text/javascript' language='JavaScript'> > > > $(document).ready( function(){ > > > $("table.tablesorter").tablesorter(); > > > var $multisort = $("table.multisort"); > > > $multisort.addClass( "multisort_unsorted" ); > > > $multisort.bind( "sortStart", function(){ > > > $(this).removeClass( "multisort_unsorted" ); > > > }); > > > $multisort.filter( ".multisort_unsorted" ).bind( "sortEnd", function(){ > > > var sortOrder = [ this.config.sortList ]; // get sort order > > > $multisort.filter( ".multisort_unsorted" ).removeClass( > > > "multisort_unsorted" ).trigger( "sorton", sortOrder ); > > > setTimeout( function(){ $multisort.addClass( "multisort_unsortedd" ); > > }, > > > 0 ); // avoid retriggering > > > }); > > > }); > > > </script> > > > </head> > > > <body> > > > <table class="tablesorter multisort"> > > > <thead> > > > <tr> > > > <th>col 1</th> > > > <th>col 2</th> > > > <th>col 3</th> > > > </tr> > > > </thead> > > > <tbody> > > > <tr> > > > <td>1</td> > > > <td>10</td> > > > <td>beef</td> > > > </tr> > > > <tr> > > > <td>1</td> > > > <td>6</td> > > > <td>sausage</td> > > > </tr> > > > <tr> > > > <td>-3</td> > > > <td>12</td> > > > <td>ham</td> > > > </tr> > > > <tr> > > > <td>-3</td> > > > <td>6</td> > > > <td>beef</td> > > > </tr> > > > <tr> > > > <td>4</td> > > > <td>7</td> > > > <td>pork</td> > > > </tr> > > > <tr> > > > <td>4</td> > > > <td>7</td> > > > <td>beef</td> > > > </tr> > > > </tbody> > > > </table> > > > <table class="tablesorter multisort"> > > > <thead> > > > <tr> > > > <th>col 1</th> > > > <th>col 2</th> > > > <th>col 3</th> > > > </tr> > > > </thead> > > > <tbody> > > > <tr> > > > <td>11</td> > > > <td>4</td> > > > <td>pork</td> > > > </tr> > > > <tr> > > > <td>12</td> > > > <td>3</td> > > > <td>ham</td> > > > </tr> > > > <tr> > > > <td>10</td> > > > <td>1</td> > > > <td>sausage</td> > > > </tr> > > > <tr> > > > <td>4</td> > > > <td>7</td> > > > <td>pork</td> > > > </tr> > > > </tbody> > > > </table> > > > <table class="tablesorter multisort"> > > > <thead> > > > <tr> > > > <th>col 1</th> > > > <th>col 2</th> > > > <th>col 3</th> > > > </tr> > > > </thead> > > > <tbody> > > > <tr> > > > <td>7</td> > > > <td>-2</td> > > > <td>turkey</td> > > > </tr> > > > <tr> > > > <td>4</td> > > > <td>7</td> > > > <td>pork</td> > > > </tr> > > > <tr> > > > <td>20</td> > > > <td>-10</td> > > > <td>beef</td> > > > </tr> > > > <tr> > > > <td>17</td> > > > <td>6</td> > > > <td>fish</td> > > > </tr> > > > </tbody> > > > </table> > > > > On Tue, Aug 4, 2009 at 11:57, Crazy Serb <crazys...@gmail.com> wrote: > > > > > In using Tablesorter plugin, I have run into an challenging issue. > > > > > What I am looking to do is group certain rows in a single table into > > > > two different groups, have a blank row between them and be able to > > > > sort based on columns that apply to both groups of rows but without > > > > the rows from one group actually mixing with the rows from another > > > > group. > > > > > So, basically, I want to have a table like this: > > > > > TABLE: > > > > Group 1 Row 1 > > > > Group 1 Row 2 > > > > Group 1 Row 3 > > > > Group 1 Row 4 > > > > - blank row - > > > > Group 2 Row 1 > > > > Group 2 Row 2 > > > > Group 2 Row 3 > > > > > So any re-sorting on any of the columns would sort the top 4 rows > > > > amongst themselves, keep the blank row after that 1st group and then > > > > resort the bottom 3 rows amongst themselves too, without any > > > > intermingling and mixing of the two groups of rows. > > > > > Is this possible at all, with some modifications or custom plugin/ > > > > code? How would I go about putting this together if so? > > > > > Thanks!