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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:41:43+00:00 2026-05-26T20:41:43+00:00

I am trying to do a multi column filter as shown in this page

  • 0

I am trying to do a multi column filter as shown in this page (http://www.datatables.net/examples/api/multi_filter.html) using a array that contain all the data (called ‘my_array_data’) but I could not get those filter text box displayed.

Below is the code:

<script type="text/javascript">

var asInitVals = new Array();

$(document).ready(function() {


            $('#dynamic').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
            var oTable = $('#example').dataTable( {
                "aaData": my_array_data,
                "bProcessing": true,
                "bAutoWidth": false,
                "fnInitComplete": function() {
                                var oSettings = this.fnSettings();
                                for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ ){
                                    if(oSettings.aoPreSearchCols[i].sSearch.length>0){
                                        $("tfoot input")[i].value = oSettings.aoPreSearchCols[i].sSearch;
                                        $("tfoot input")[i].className = "";
                                    }
                                }
                            },
                "aoColumns": [
                    {
                        "sTitle": "From",
                        "sClass": "center",
                        "sWidth": "10%"
                    },
                    {
                        "sTitle": "To",
                        "sClass": "center",
                        "sWidth": "10%"
                    },
                    {
                        "sTitle": "Note",
                        "sClass": "center",
                        "sWidth": "80%"
                    }
                ]
            } );


            $("tfoot input").keyup( function () {
                /* Filter on the column (the index) of this element */
                oTable.fnFilter( this.value, $("tfoot input").index(this) );
            } );


            /*
             * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
             * the footer
             */
            $("tfoot input").each( function (i) {
                asInitVals[i] = this.value;
            } );

            $("tfoot input").focus( function () {
                if ( this.className == "search_init" )
                {
                    this.className = "";
                    this.value = "";
                }
            } );

            $("tfoot input").blur( function (i) {
                if ( this.value == "" )
                {
                    this.className = "search_init";
                    this.value = asInitVals[$("tfoot input").index(this)];
                }
            } );


});

For your info: I do not have a <table> ... </table> as mention before that I store my data in the array called ”my_array_data’ and therefore do not have <input class="search_init"/>. Also, “my_array_data” contain three column – basically named as – “From”, “To”, and “Note”.

Any Insight in getting 3 columns of search filter for my array “my_array_data”?

Appreciate any help offer.

  • 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-26T20:41:44+00:00Added an answer on May 26, 2026 at 8:41 pm

    You need to define those 3 text boxes on your markup. Here’s a shortened example of how I currently achieve the same thing using datatables:

    <table id="example">
    <thead>
        <tr>
            <th class="theader">
                Date
            </th>
            <th class="theader">
                Delay
            </th>
            <th class="theader">
                Status
            </th>
        </tr>
    </thead>
    <tbody>
    </tbody>
    <tfoot>
        <tr>
            <th class="centered">
                <input type="text" id="id1" name="id1" class="search_init" />
            </th>
            <th class="centered">
                <input type="text" id="id2" name="id2" class="search_init" />
            </th>
            <th class="centered">
                <input type="text" id="id3" name="id3" class="search_init" />
            </th>
        </tr>
    </tfoot>
    </table>
    

    And my initialization code is something like:

    var oTable = $("#example").dataTable({
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "bSortClasses": false, 
            //...etc etc
    });
    
    $("tfoot input").keyup(function(event) {
     /* Filter on the column (the index) of this element */
     if (event.keyCode == 13)//only on enter pressed
     {
        var colIndex = getColumnIndex(this.id);//this is a custom function I wrote. Ignore it
        oTable.fnFilter(this.value, colIndex);
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out how this jQuery plugin works: http://codeasily.com/jquery/multi-column-list-with-jquery In the plugin
jsFiddle: http://jsfiddle.net/4z2Vx/ I'm trying to create a multi-column dropdown/menu widget. The image on the
Trying to execute this statement in a rails migration to generate a multi column
I am trying to create a multi dimensional array using this syntax: $x[1] =
I hwas trying to generate a multi page XPS document from a web application
I'm trying to create a unique multi-column index on a table in Access. Several
I am trying to make my gridview control in ASP.Net do a multi sort
I'm working on multi-lang website. Trying to design optimal db schema for this purpose.
I'm trying to add multi-language support to an OpenSocial application. I see that I
i'm trying to get multi tenancy working in my app - using nhibernate integration

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.