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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:28:29+00:00 2026-05-28T21:28:29+00:00

I am using a jquery script called datatables, this adds a lot of functions

  • 0

I am using a jquery script called datatables, this adds a lot of functions to your tables like searching and filtering etc and enables you to skin the tables with the jquery ui. I am trying to replicate the following example on my website so that I can filter columns.
http://www.datatables.net/release-datatables/examples/api/multi_filter_select.html
The problem I am having now, is when I use the following script on my website it strips away the jquery ui on all the other tables.

For example on one of the other tables I have this set in the of the page :

      $(document).ready( function() {

        $('#mailinglistmanager').dataTable( {

            "bJQueryUI": true,

            "bInfo": true,

            "bAutoWidth": true,

            "bFilter": false,

            "bLengthChange": true,

            "bPaginate": true,

            "bProcessing": true,

             "bSort": true,

              "sPaginationType": "full_numbers",

               "aaSorting": [[ 6, "desc" ]],

                "iDisplayLength": 100,

                "bLengthChange": false   

        } );

        });

     </script>

this and the other tables seem to work fine until I add the code below, then what happens is the other tables are stripped of the jquery ui and only the table defined below is skinned then, and all the other tables are then unskinned.

            (function($) {
    /*
     * Function: fnGetColumnData
     * Purpose:  Return an array of table values from a particular column.
     * Returns:  array string: 1d data array 
     * Inputs:   object:oSettings - dataTable settings object. This is always the last argument past to the function
     *           int:iColumn - the id of the column to extract the data from
     *           bool:bUnique - optional - if set to false duplicated values are not filtered out
     *           bool:bFiltered - optional - if set to false all the table data is used (not only the filtered)
     *           bool:bIgnoreEmpty - optional - if set to false empty values are not filtered from the result array
     * Author:   Benedikt Forchhammer <b.forchhammer /AT\ mind2.de>
     */
    $.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
        // check that we have a column id
        if ( typeof iColumn == "undefined" ) return new Array();

        // by default we only wany unique data
        if ( typeof bUnique == "undefined" ) bUnique = true;

        // by default we do want to only look at filtered data
        if ( typeof bFiltered == "undefined" ) bFiltered = true;

        // by default we do not wany to include empty values
        if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;

        // list of rows which we're going to loop through
        var aiRows;

        // use only filtered rows
        if (bFiltered == true) aiRows = oSettings.aiDisplay; 
        // use all rows
        else aiRows = oSettings.aiDisplayMaster; // all row numbers

        // set up data array    
        var asResultData = new Array();

        for (var i=0,c=aiRows.length; i<c; i++) {
            iRow = aiRows[i];
            var aData = this.fnGetData(iRow);
            var sValue = aData[iColumn];

            // ignore empty values?
            if (bIgnoreEmpty == true && sValue.length == 0) continue;

            // ignore unique values?
            else if (bUnique == true && jQuery.inArray(sValue, asResultData) > -1) continue;

            // else push the value onto the result data array
            else asResultData.push(sValue);
        }

        return asResultData;
    }}(jQuery));


    function fnCreateSelect( aData )
    {
        var r='<select><option value=""></option>', i, iLen=aData.length;
        for ( i=0 ; i<iLen ; i++ )
        {
            r += '<option value="'+aData[i]+'">'+aData[i]+'</option>';
        }
        return r+'</select>';
    }


    $(document).ready(function() {
        /* Initialise the DataTable */
        var oTable = $('#dashboard').dataTable( {
           "bJQueryUI": true,

                    "bInfo": true,

                    "bAutoWidth": true,

                    "bFilter": true,

                    "bLengthChange": true,

                    "bPaginate": true,

                    "bProcessing": true,

                     "bSort": true,

                      "sPaginationType": "full_numbers",

                       "aaSorting": [[ 9, "desc" ]],

                        "iDisplayLength": 5,

                        "bLengthChange": false   
        } );

        /* Add a select menu for each TH element in the table footer */
        $("tfoot th").each( function ( i ) {
            this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
            $('select', this).change( function () {
                oTable.fnFilter( $(this).val(), i );
            } );
        } );
    } );
  • 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-28T21:28:30+00:00Added an answer on May 28, 2026 at 9:28 pm

    Your jQuery selector for fnCreateSelect selects the th elements in every tfoot for every table. Since all other tables are apparently affected, try changing $("tfoot th") to $("#dashboard tfoot th") to select only the tfoot for that table.

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

Sidebar

Related Questions

Im using jquery 1.3.2 and this is the code: <script type=text/javascript> //<![CDATA[ jQuery(function(){ jQuery('.news_bullet
After loading a PHP template (using jQuery's load function), this simple script won't make
My jQuery code (using ajax) request's data from a local php script (pgiproxy.php). This
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I am using a bespoke JQuery/PHP script which parses a Flickr feed using SimpliePie
I've been using jquery 1.3.2 to pull snippets of html (including script) from a
I'm using jQuery to post a form to a php file, simple script to
I am writing a greasemonkey script. The site is using jquery, i need a
I am using a bespoke Jquery/PHP gallery script which pulls images from a Flickr
I'm using the JQUERY UI Accordion module: <script type=text/javascript> $(function() { $(#sidebar_column_accordion).accordion({ fillSpace: true,

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.