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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:13:56+00:00 2026-06-08T00:13:56+00:00

Is it possible to apply a certain filter to only one datatable? I have

  • 0

Is it possible to apply a certain filter to only one datatable?
I have the following filter function that I am applying on document ready, I don’t know if this is proper procedure, but as a side effect all dataTables will be affected by the filter. I would Like to affect only the $(‘#productTable’), but this selector appears to not have the desired effect.

//Filter Function in Stock 
//$('#productTable').
$.fn.dataTableExt.afnFiltering.push(function(oSettings, aData, iDataIndex) {
    var checked = $('#instock').is(':checked');
    var qntStock = 1; 
    var stockCol = 3; 

    if (!checked) {
        return true;
    }
    if (checked && aData[stockCol] > qntStock) {
        return true;
    }

    return false;
 });

Is it possible to apply a filter only to a particular table? How do I accomplish this?

EDIT:

dataTable initialization:

var oTable = $('#productTable').dataTable({
        "aoColumnDefs": [{
            "sClass": "my_class", 
            "aTargets": [4]
            }],
        "bAutoWidth": false,
        "iDisplayLength": 100,
        "fnDrawCallback": function() {
            $("td.my_class").editable(function(value, settings) 
            { 
                return(value);
            }, 
            {
                indicator : 'Save...',
                tooltip   : 'Click to Edit...'
            }
            );
        }
    });
  • 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-08T00:13:58+00:00Added an answer on June 8, 2026 at 12:13 am

    You could create an array of tables to have the filter – then in your filter check if the current table is present in that array … something like :

    // setup an array of the ids of tables that should be allowed
    var allowFilter = ['productTable'];
    
    $.fn.dataTableExt.afnFiltering.push(function(oSettings, aData, iDataIndex) {
    
        // check if current table is part of the allow list
        if ( $.inArray( oSettings.nTable.getAttribute('id'), allowFilter ) == -1 )
        {
           // if not table should be ignored
           return true;
        }
        var checked = $('#instock').is(':checked');
        var qntStock = 1; 
        var stockCol = 3; 
    
        if (!checked) {
            return true;
        }
        if (checked && aData[stockCol] > qntStock) {
            return true;
        }
    
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to apply a workflow in Sitecore only for a particular user?
In my AppEngine project I have a need to use a certain filter as
I have the following xslt sheet and I am wondering if its possible to
Is there a way to apply a skin only to controls of a certain
Is it possible to have one CSS class reference another? Instead of rewriting all
Is it possible to pass an anonymous function as an argument, and have it
I am trying to use a filter to insert certain text into ScriptResource.axd that
I'm working on a site where a user could select certain dates that apply
Is it possible to apply a heading style (especially heading 3 as in excel
Is it possible to apply formatting to a specific row in Slickgrid? I am

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.