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 9281585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:09:26+00:00 2026-06-18T18:09:26+00:00

I am using JQuery Tablesorter 2.7.* for a JavaScript table I have. I am

  • 0

I am using JQuery Tablesorter 2.7.* for a JavaScript table I have. I am also using the Tablesorter Filter widget, in order to have several of my columns have drop-down filtering options. I have a new challenge: I am required to add columns to the table dynamically. I have seen this question: Adding columns dynamically to a table managed with jQuery's tablesorter – which recommends that I remove and recreate the table with each addition/removal of a column. This is fair enough, however this causes a conflict with the Filter Widget.

In order to apply the Filter functions, the JavaScript references the column by index only, as so:

        widgetOptions: {
            filter_reset: '.reset',
            filter_functions: {
                2: true,
                3: true,
            }
        }

This code would cause columns with index 2 and 3 to have the default select Filter. The problem occurs when new columns are added dynamically – the index values of these columns are likely to change.

This brings my question; is there any way to apply widget options to columns named specifically by name? If not, is there some solution I can implement that would achieve the functionality where I can add/remove columns dynamically, without disturbing the filter functions?

Edit: I am also using filter functions.

  • 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-18T18:09:27+00:00Added an answer on June 18, 2026 at 6:09 pm

    Update #2: As of tablesorter v2.17.0 a class name* or ID can be used to target a column within the filter_functions option:

    // filter functions
    widgetOptions: {
        filter_functions : {
            ".exact" : function(e, n, f, i) {
                return e === f;
            }
        }
    }
    

    * Note: the class name can not include a selector that uses any kind of indexing, e.g. "th:eq()", ":gt()", ":lt()", ":first", ":last", ":even" or ":odd", ":first-child", ":last-child", ":nth-child()", ":nth-last-child()", etc.


    In the docs, it shows an alternative to using the filter_functions option:

    Alternately, instead of setting the column filter function to true, give the column header a class name of “filter-select”. See the demo.

    So, just add a filter-select class name to the column instead.


    Update: Since other filter functions are being used, you can define these functions outside of the initialization code (demo)

    // Add these options to the select dropdown (date example) 
    // Note that only the normalized (n) value will contain
    // the date as a numerical value (.getTime())
    var dateFxns = {
    
        // Add these options to the select dropdown (date example) 
        // Note that only the normalized (n) value will contain
        // the date as a numerical value (.getTime())
        "< 2004": function (e, n, f, i) {
            return n < Date.UTC(2004, 0, 1); // < Jan 1 2004
        },
        "2004-2006": function (e, n, f, i) {
            return n >= Date.UTC(2004, 0, 1) && // Jan 1 2004
            n < Date.UTC(2007, 0, 1); // Jan 1 2007
        },
        "2006-2008": function (e, n, f, i) {
            return n >= Date.UTC(2006, 0, 1) && // Jan 1 2006
            n < Date.UTC(2009, 0, 1); // Jam 1 2009
        },
        "2008-2010": function (e, n, f, i) {
            return n >= Date.UTC(2008, 0, 1) && // Jan 1 2006
            n < Date.UTC(2011, 0, 1); // Jam 1 2009
        },
        "> 2010": function (e, n, f, i) {
            return n >= Date.UTC(2010, 0, 1); // Jan 1 2010
        }
    },
    currentDateColumn = 3,
    filterFxn = {};
    filterFxn[currentDateColumn] = dateFxns;
    
    $('table').tablesorter({
        widgets: ['zebra', 'filter'],
        widgetOptions: {
            filter_functions: filterFxn
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jQuery tablesorter plugin to sort a table with 14 columns.
I'm using the jquery Tablesorter with the zebra widget for my table. I want
I have a table that I've made sortable using the jQuery plugin Tablesorter 2.0
I'm using the jQuery Tablesorter and have an issue with the order in which
I'm using jQuery Tablesorter to sort a table. One of my columns looks like
I am several tables within a big table and I am using jquery tablesorter
I have a simple question regarding jQuery selectors. I'm using the tablesorter and I
I am using the jquery tablesorter plugin to sort a table. On of my
I'm using jQuery Tablesorter to sort a table and everything works as expected. What
I am using the jquery tablesorter plugin and applies it to a table with

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.