I am attempting to use the TinyTableV3 JQuery plugin; however, I keep getting an ‘undefined’ does not exist error. Then, when clicking the columns for sorting I get the ‘sorter’ does not exist error. This indicates an initialization issue, but as there seems to be no readme for this plugin, I’m not certain where it might be going wrong. Code below. Help?
<html>
<head>
<script type="text/javascript" src="javascript/jquery.1.8.3.min.js"></script>
<script type="text/javascript" src="javascript/TinyTableV3/script.js"></script>
<script type="text/javascript">
var sorter;
$(document).ready(function () {
sorter = new TINY.table.sorter('sorter', 'listtbl', {
headclass: 'head',
ascclass: 'asc',
descclass: 'desc',
evenclass: 'evenrow',
oddclass: 'oddrow',
evenselclass: 'evenselected',
oddselclass: 'oddselected',
paginate: false,
size: 100,
sortcolumn: 1,
sortdir: 1,
init: true
});
});
</script>
</head>
<body>
<table id="listtbl" class="listtbl">
<tr>
<th>number</th>
<th>name</th>
<th>address</th>
<th>comment</th>
</tr>
<tr>
<td>97</td>
<td>bob</td>
<td>666 mantime</td>
<td>this is a comment</td>
</tr>
<tr>
<td>912</td>
<td>daisy</td>
<td>856 mantime</td>
<td>this is a comment</td>
</tr>
<tr>
<td>24</td>
<td>john</td>
<td>666 sooome</td>
<td>this is a comment</td>
</tr>
<tr>
<td>365</td>
<td>kindle</td>
<td>66 mantimed</td>
<td>this is a comment</td>
</tr>
<tr>
<td>56</td>
<td>ishmael</td>
<td>12 diddles</td>
<td>this is a comment</td>
</tr>
<tr>
<td>234</td>
<td>hoppy</td>
<td>666 mantime</td>
<td>this is a comment</td>
</tr>
<tr>
<td>43</td>
<td>snaps</td>
<td>666 mantime</td>
<td>this is a comment</td>
</tr>
<tr>
<td>123</td>
<td>pickpic</td>
<td>666 mantime</td>
<td>this is a comment</td>
</tr>
<tr>
<td>15</td>
<td>hahazabamadan</td>
<td>666 mantime</td>
<td>this is a comment</td>
</tr>
</table>
</body>
</html>
tiny table v3 found at http://www.scriptiny.com/2009/11/advanced-javascript-table-sorter/
Try renaming your
var tinytabletovar sorter– that seemed to be the issue in this fiddlehttp://jsfiddle.net/cP6qv/
Also your html was was mixed up – your body tag was inside your head tag. etc..
You should also use tags to wrap your and to wrap your table body