I have a page with a table and I use jquery's tablesorter plugin on it. Occasionally I get this error:
Message: Unable to get value of the property 'type': object is null or undefined Line: 8 Char: 2558 Code: 0
This is the code that I have in my page:
<script type="text/javascript">
$(function () {
if ($("table#table_tb1").find("tbody").find("tr").size() > 1) {
$("table#table_tb1").tablesorter({ sortList: [[0, 1]] });
}
});
The if clause is to overcome a bug with the same plugin which occurs when the table is empty.
This is the line in tablesorter.js where the error occurs:
var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));
Thanks in advance!
Seems a lot of people are ending up on this question after searching, so I'll post my own solution.
The table was empty. Have values in the tables and the problem goes away. If the table is empty, do not initialize tablesorter plugin.