[jQuery] parsers is undefined in tablesorter?
Hi,
I am trying to generate dynamically a table from a csv by using jquery
csv plugin and the jquery tablesorter plugin and tablesorter is giving
me a bizarre error each time I try to click on a header of the table
to sort it. Firebug shows:
parsers is undefined
return parsers[i].type;\n
seems to be in line 483 of the tablesorter.js
I found this post on this issue:
http://groups.google.com/group/jquery-en/browse_thread/thread/a22dcbf8c5d69202
but neither of those suggestions worked.
initially i thought this error was related to the table not being
fully rendered when the page loads, so right now i manually call
tablesorter() after i generate the table from the csv file. however i
still get this error message every time i try to sort it (by clicking
on the table headers).
Also, i suppose because of this error, the table renders at the bottom
of it some grey areas.
does anyone know what might be causing this error?
here is my code:
<html>
<head>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/
files/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://tablesorter.com/
jquery.tablesorter.js"></script>
<script type="text/javascript" src="http://plugins.jquery.com/files/
jquery.csv.js_0.txt"></script>
<script type="text/javascript" id="js">
function sortThis() {
$("#myTable").tablesorter({
// sortList:[[0,0],[2,1]]
});
};
</script>
<title>test table</title>
</head>
<body>
<table id="myTable" class="tablesorter" cellspacing="1"
cellpadding="0" border="0">
<thead>
<tr>
<th>ISBN</th>
<th>Full Title</th>
<th>Change History</th>
<th>Year Range</th>
</tr>
</thead>
<tbody>
<script type="text/javascript">
$.get('bfcompusci.csv', function(data) {
file = jQuery.csv()(data)
for (var x = 0; x < file.length; x++) {
str = "<tr>";
for (var y = 0; y < file[x].length; y++) {
str += "<td>" + file[x][y] + "</td>";
}
str += "</tr>";
$('#myTable').append(str);
}
});
sortThis();
</script>
</tbody>
</table>
</body>
</html>
thanks in advance for your help.