Rohit Chopra Rohit Chopra - 1 month ago 11
jQuery Question

Sorting a table within a table

I am several tables within a big table and I am using jquery tablesorter for sorting the main table.

I would like to be able to sort the individual tables within the main table as well. Example code:

<table class="info tablesorter" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>

<th colspan>The Name</th>
<th>Geography</th>
<th colspan="5">Prospective clients</th>

</tr>
</thead>
<tbody>

<Tr class="parent" id="id_1" style='background-color: white'>

<TD style=vertical-align:middle>Main echo 1</td>
<TD style=vertical-align:middle>New York, NY</td>
<td colspan="5">55</td>
</tr>
<tr class="child-id_1 expand-child" style="display:none">
<td colspan='7'>
<table class="ctable_1 ts2" width=75% id="class_id_1">

<thead><tr>
<th>URL</th>
<th>Contact Page</th>
<th>Phone</th>
<th>GoogleIndex</th>
<th>Listed in next?</th>
<th>Created On</th>
</tr></thead>
<tbody>
<tr class='childofmarket'>
<td> xyz </td>
<td> aaa</td>
<td> ###-###-#### </td>
<td>127</td>
<td>- No -</td>
<td>03-09-2011</td>
</tr>
<tr class='childofmarket'>
<td> aak</td>
<td>csa</td>

<td>##########</td>
<td>69</td>
<td>- No -</td>
<td>03-09-2011</td>
</tr>


and so on. I keep getting the


Error: parsers[i] is undefined


Can anyone tell me what I need to fix here?

Answer

Don't know if you have tried but give all your tables the same class IE. sorted_table

please say which tablesorter you are using, I prefer this one Tablesorter

this in javascript use something like

$(document).ready(function()
{
     $('.sorted_table').tablesorter();
});
Comments