I am having issues with the tablesorter. The error is: n[0] is undefined
function appendToTable(table,cache) { if(table.config.debug) {var appendTime = new Date()} var c = cache, r = c.row, n= c.normalized, totalRows = n.length, checkCell = (n[0].length-1), tableBody = $(table.tBodies[0]), rows = []; for (var i=0;i < totalRows; i++) { rows.push(r[n[i][checkCell]]); if(!table.config.appender) { var o = r[n[i][checkCell]]; var l = o.length; for(var j=0; j < l; j++) { tableBody[0].appendChild(o[j]); } //tableBody.append(r[n[i][checkCell]]); } }
Above is a code snippet from the jquery.tablesorter.js The line where it says checkCell = (n[0].length - 1) is where the error is occuring.
I do not understand how an undefined object is being passed into the function. The tablesorter was working fine in one of my project but not working fine on this project.
[EDIT] This is the code snippet used to call the tablesorter. If I comment out the tablesorter and tablesorterPager nothing else in my code will break.
$reviewTable = $("#reviewTable"); $reviewTable.tablesorter(); $reviewTable.tablesorterPager({ container: $("#pager"), size: 100, widgets: ['zebra'] });
Below is the client side
<asp:Repeater ID="reviewRepeater" runat="server"> <HeaderTemplate> <table cellpadding="0" cellspacing="0" class="MarkAsReceived" id="reviewTable"> <thead> <tr class="even"> <th align="left">Review ID</th> <th align="left">Date Submitted</th> <th align="left">Rating</th> <th align="left">Image</th> <th align="left">ProductId</th> <th align="left">Status</th> <th align="left">Name</th> </tr> </thead> <tbody> </HeaderTemplate> <ItemTemplate> <tr> <td align="left"><%#DataBinder.Eval(Container.DataItem, "ReviewId")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "SubmissionDate")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "Rating")%></td> <td align="left"><%#hasImage(DataBinder.Eval(Container.DataItem, "ReviewerImages"))%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "ProductId")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "Status")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "Nickname")%></td> </tr> </ItemTemplate> <AlternatingItemTemplate> <tr> <td align="left"><%#DataBinder.Eval(Container.DataItem, "ReviewId")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "SubmissionDate")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "Rating")%></td> <td align="left"><%#hasImage(DataBinder.Eval(Container.DataItem, "ReviewerImages"))%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "ProductId")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "Status")%></td> <td align="left"><%#DataBinder.Eval(Container.DataItem, "Nickname")%></td> </tr> </AlternatingItemTemplate> <FooterTemplate> </tbody> </table> <asp:Label ID="lblEmpty" Text="No Items." runat="server" Visible='<%# reviewRepeater.Items.Count == 0 %>'></asp:Label> </FooterTemplate> </asp:Repeater>