Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6992105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:35:29+00:00 2026-05-27T19:35:29+00:00

I am having issues with the tablesorter. The error is: n[0] is undefined function

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:35:30+00:00Added an answer on May 27, 2026 at 7:35 pm

    If I remember, you are getting that error because the table is initially empty ( the tbody ). So modify that line of code from this:

    checkCell = (n[0].length-1),
    

    to this:

    checkCell = totalRows ? (n[0].length - 1) : 0,
    

    If you are interested, I’ve forked and added lots of enhancements (including the change above) to the original tablesorter plugin on github.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having issues referencing $(this) from within a the nested ajax 'success' function... I know
At work we're having issues with different people wanting/suggesting different names for a new
Having issues calling the ReportingService2005.FindItems() method from within powershell v2. $rs = New-WebServiceProxy -Uri
I'm having issues with a very strange error in some code I wrote. The
I'm having issues getting a variable declared in an .click function to be updated
I'm having issues writing a C function that reads a string from STDIN, and
Im having issues with my code, its returning an error that says... 2011-12-24 22:52:36.280
Im having issues trying to join a table twice. I have 3 tables: Users,
I am having issues with asset_path in production. Rails 3.1.1 #config/environments/development.rb Scc::Application.configure do #
I'm having issues passing an array struct into a function for processing. I think

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.