tablesorter - how to get the name (or index) of the column about to be sorted in sortStart?

tablesorter - how to get the name (or index) of the column about to be sorted in sortStart?

Hello,

I'm building a table to represent a mall's directory of stores. I'm allowing sorts on name, category and map location, but the system allows multiple categories. I'd like to have each store represented once with a comma seperated list in the category column when sorted by name. However when sorted by category I'd like to create multiple rows, each corresponding to the entry with one of the categories in the column.

Example

Sorted by Name
+---------+------------+
| Name    | Category   |
+---------+------------+
| Store 1 | Cat1       |
| Store 2 | Cat2       |
| Store 3 | Cat1, Cat2 |
+---------+------------+


Sorted by Category
+---------+------------+
| Name    | Category   |
+---------+------------+
| Store 1 | Cat1       |
| Store 3 | Cat1       |
| Store 2 | Cat2       |
| Store 3 | Cat2       |
+---------+------------+

I'm pretty sure I need to be looking at the sortStart function, which I've been able to bind successfully. I'm unable to figure out how to tell which column was selected however, which I'll need to trigger the functions that will break apart and recombine (or hide and show) the appropriate rows.

I guess the short version of the question is, does anybody know how to get the name (or index) of the column about to be sorted in sortStart?

    • Topic Participants

    • thart