问题
With the latest version of the plugin as of 5/4/2011 on OSX 10.6.7 w FF 3.6.12 Chrome, Safari, and IE all work perfectly fine. I also tried it with FireBug disabled to no avail.
Here's the HTML I'm testing with:
<!DOCTYPE html>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<script src="/javascripts/jquery/jquery-1.4.4.min.js?1301000558" type="text/javascript"></script>
<script src="/javascripts/jquery.tablesorter.js?1304537000" type="text/javascript"></script>
<script>
$(document).ready(function () {
$("#testtable").tablesorter( {debug:true} );
});
</script>
</head>
<body>
<table id='testtable'>
<thead>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
</thead>
<tbody>
<tr>
<td>val1</td>
<td>val2</td>
<td>val3</td>
</tr>
<tr>
<td>val2</td>
<td>val1</td>
<td>val3</td>
</tr>
<tr>
<td>val3</td>
<td>val1</td>
<td>val2</td>
</tr>
</tbody>
</table>
</body>
</html>
With firebug on, here are the messages before trying to click on a column header:
Built headers:,0ms
[th.header, th.header, th.header]
Checking if value was empty on row:0
Checking if value was empty on row:0
Checking if value was empty on row:0
column:0 parser:text column:1 parser:text column:2 parser:text
Building cache for 3 rows:,0ms
Here's the errors after clicking:
table.config.parsers[c] is undefined
which is in the setTimeout function around line 600 in the un-minified source.
回答1:
I also had the same issue, the problem was I was using empty <TR> which had COLSPAN in all the empty rows.
When I removed the <td colspan="3"> and did three empty <TD> the problem was gone.
回答2:
I know this is old, but I ran into the same issue when inserting dynamic data into rows using PHP. The issue only occurred in IE. All I had to do was to silence the debug, like this:
$("#testtable").tablesorter( {debug:false} );
The JS kicks in before the PHP code has had time to populate the fields with data, so the error was displayed. Easy fix.
回答3:
I fixed this problem by downloading version 2.15.5 from here.
来源:https://stackoverflow.com/questions/5889232/tablesorter-jquery-plugin-fails-in-ff-3-6-12-with-msg-table-config-parsersc-i