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

  • SEARCH
  • Home
  • 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 7838219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:02:27+00:00 2026-06-02T15:02:27+00:00

I am using tablesorter with MVC 3 and html helpers to populate columns inside

  • 0

I am using tablesorter with MVC 3 and html helpers to populate columns inside of a for each loop that passes through items in an object. This is working fine, and my html table is being populated the way I want. But I’m having a problem sorting the employee name, which is the second column in the table, which looks like this:

                <td class="reviewedEmployee">
                    @Html.TextBox("Employees", item.FirstName + "  " + item.LastName, new { style = "width:auto !important; text-align:center;" })
                </td>

When I click on the “Employee” title, which is formatted correctly to use table sorter, no sorting happens. But when I click on another column, like “List of Reviewers” (which is an @Html.ListBox from a select list), it sorts by that column. I can click back to the “Employee” title, and it will make changes, but they aren’t alphabetical (first name + last name). Sorting also doesn’t work for the first column, “Year”, which just displays either 2011 or 2012.

Here is my JS:

    $(document).ready(function () {
        $('table.tablesorter').tablesorter({ textExtraction: 'complex' })
          .tablesorterPager({ container: $("#pager"), size: $(".pagesize option:selected").val() });
});

I’ve tried getting rid of spaces in the “Employee” column data and i removed the “textExtaction” property from tablesorter. Any other ideas?

UPDATE: My data in the table are input tags, so I need to find out how to sort by value, possibly by adding a tablesorter.AddParser() method to return the cells .val() inside an input tag.

  • 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-06-02T15:02:27+00:00Added an answer on June 2, 2026 at 3:02 pm

    Instead of using input tags rendered by razor view, I used HTML helpers to get the first and last name from the database, which comes up as Raw text in tables. For some reason, tablesorter couldn’t sort any row that had an input.

    Fix: Add a hidden field in the same with the value set as the visible field’s value.

    My Fix: After getting Raw Text, I implemented my own custom Parser settings to sort a Column by last name.

        $.tablesorter.addParser({
        id: "lastName",
        is: function (s) {
            return false;
        },
        format: function (s) {
            ret = s.split(' ');
            return ret[ret.length-1]
        },
        type: "text"
    });
    

    Also, I added span tags to the raw HTML to give style and other attributes, such as a class that is selected in jQuery to update the table when new data is submitted. See Below:

            //if data is changed, trigger an update on the text boxes to make sure filtering is up to date. 'allocation' is any dynamic field in a row such as textbox
        $(".allocation").change(function () {
            $("#manageReviewsTable").trigger("update");
            $("#manageReviewsTable").trigger("appendCache");
        });
    

    Any questions, comment below!

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

Sidebar

Related Questions

I am Using http://tablesorter.com/docs/example-options-headers.html $(#sort-table).tablesorter( {headers: { 0: { sorter: false }, dynamic_value: {
i have an html table inside a form in an asp.net mvc view. I
I'm using the JQuery tablesorter plugin. The table has a column that shows dates
I'm using the jQuery tablesorter plugin and I have a column that contains name
I am using tablesorter for my tables, and now I want that always the
I am using the jQuery tableSorter plugin on a page. Unfortunatley, the table that
I'm using jQuery Tablesorter to sort a table. One of my columns looks like
I have a basic table with tablesorter installed, sorting on hidden columns using links
I'm using the tablesorter JQUery plugin to sort the rows of a HTML table
I a couple of issues using Tablesorter 2.0.3. The first issue is when I

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.