Tables plug-in for jQuery

  • By SpryMedia Limited
  • Last update: Dec 25, 2022
  • Comments: 15

DataTables plug-in for jQuery

DataTables is a table enhancing plug-in for the jQuery Javascript library, adding sorting, paging and filtering abilities to plain HTML tables with minimal effort. The stated goal of DataTables is:

To enhance the accessibility of data in HTML tables.

To meet this goal, DataTables is developed with two distinct groups of users in mind:

  • You the developers using DataTables. For developers DataTables provides a wide array of options for how data should be obtained, displayed and acted upon, along with an extensive API for accessing and manipulating the table.

  • End users. For those using the interface DataTables presents, actions to get the most from the information contained in tables, such as sorting and filtering, along with paging and scrolling of the data in table, are easy to use, intuitive and fast.

Installing DataTables

To use DataTables, the primary way to obtain the software is to use the DataTables downloader. You can also include the individual files from the DataTables CDN. See the documentation for full details.

NPM and Bower

If you prefer to use a package manager such as NPM or Bower, distribution repositories are available with software built from this repository under the name Styling packages for Bootstrap, Foundation and other styling libraries are also available by adding a suffix to the package name.

Please see the DataTables NPM and Bower installation pages for further information. The DataTables installation manual also has details on how to use package managers with DataTables.


In its simplest case, DataTables can be initialised with a single line of Javascript:


where the jQuery selector is used to obtain a reference to the table you want to enhance with DataTables. Optional configuration parameters can be passed in to DataTables to have it perform certain actions by using a configuration object as the parameter passed in to the DataTables constructor. For example:

$('table').dataTable( {
  paginate: false,
  scrollY: 300
} );

will disable paging and enable scrolling.

A full list of the options available for DataTables are available in the documentation.


Full documentation of the DataTables options, API and plug-in interface are available on the DataTables web-site. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.


Support for DataTables is available through the DataTables forums and commercial support options are available.


DataTables is release under the MIT license. You are free to use, modify and distribute this software, as long as the copyright header is left intact (specifically the comment block which starts with /*!).



  • 1

    Add API support to remove child rows

    To resolving issue Please review for correctness. I am new to the code base but would like to have this feature make it into the next release. I would appreciate feedback and I am not expecting this to be 100% correct...but it is a start.

  • 2

    Add JSPM (package manager) compatibility

    • JSPM is a new package manager and dependency loader.
    • Added the jspm property to package.json which allows jspm to properly install DataTables and its dependencies.
    • The DataTablesSrc repository does not have a package.json file, therefore the reason for contributing to this repo.
    • Also, jspm installs the latest released zip from Github, so this change would have to be merged and released in order for jspm to install DataTables.
    • I've also submitted a pull-request to jspm/registry that would add DataTables to the jspm registry.
  • 3

    [EASY PICK] Fixed package name in composer.json

    packagist/composer requires a lowercase name

    With the former package name being DataTables/DataTables it is not possible to add this library to packagist which makes this file useless in it's current state.

    Please note the error message when trying to submit the package to packagist.

    "The package name DataTables/DataTables is invalid, it should not contain uppercase characters. We suggest using data-tables/data-tables instead."

  • 4

    callback after fnRender

    Added new callback named fnRenderAfter, that gets called just like fnRender, with the same parameter, plus nTd and nTr added to o Object. Can be used to manipulate a cell, even after a fnUpdate. See

  • 5

    New callback fnRenderAfter

    I added a new callback named fnRederAfter that will be defined for every column and called for every cell, but AFTER the cell was created. It passes two parameters:

    An object with the following properties:

    iDataRow iDataColumn aData oSettings mDataProp nTd nTr

    , and cell data (retrieved using _fnGetCellData)

    A very simple example on how to use it :

    fnRenderAfter: function(oObj) {
        // jQuery cell element
        var cell = jQuery(oObj.nTd);
        var row = oObj.nTr;
        var span = jQuery('<span></span>');
        switch (oObj.aData.status) {
            case '0': // pending
                span.css('color', '#0000FF').text('Pending');
            case '1': // completed
                span.css('color', '#FFC828').text('Completed");
        cell.html(span.css('font-weight', 'bold'));
  • 6

    language.url and column title can be a function now

    For i18n support I needed to be more flexible with the language url and column title settings. I just added a check if those settings are a function and execute them if so.

    It's just little overheading while gaining much more flexibility, maybe you should consider doing this for all settings.

  • 7

    Allow for inserting html elements and nodes into td (using mRender).

    A developer may way want to append an element or node in cell data rather than only html. This is particularly useful when attempting to retain binding connections between the dom and an object. For example, useful to bind a Backbone View object to a dom node; otherwise, without this, using to html() on the backbone view destroys the binding connection.

    The two new functions used to test isElement and isNode were both taken from StackOverflow

  • 8

    Support fnOnParserError from server data

    This gives an option for users to define what to do when there's a parser error from server data, like for instance, letting the user know he must refresh the whole page (when session timed out).

  • 9

    bProcessing: add modal div behind

    Hi Allan, I managed to do some work regarding this modalbox-like concept. I needed it for my project so I decided to start doing something.

    Could you please take a look and tell me what's missing? I tried to comply with the conventions but I'm still shaking on it.

    EDIT: Forgot to branch... damn! Sorry...

    Thank you so much! PS: If this goes forward, this will be my very first code contribution for anything. happyface

  • 10

    Manual resizing of columns

    Basically, this patch adds a third method for sizing columns in the code base. The first method is the bAutoWidth path which sizes the columns based on the dimensions of their largest visible text. The second is to set the widths during initialization, turn off bAutoWidth and never adjust them again. This third method basically gives full control of column sizing to the user.

    The user would modify th eaoColumns[n].width field in the fnSettings property bag to specify new fixed column widths and then calling fnAdjustColumnSizing to apply the new widths exactly. Without this patch, fnAdjustColumnSizing would call the fnCalculateColumnWidth function (if bAutoWidth is true) thereby modifying the values the user gave, or if bAutoWidth is false, the fnAdjustColumnSizing function is no-op. This lets the user set bAutoWidth to false and applies their specified column dimensions.

    If you have any questions please do let me know.

  • 11

    Add bSortMulti option to disallow multiple-column sorting

    Added a bSortMulti feature option. When set to false, pressing the shift key to sort multiple columns at once will be disabled. This is handy when simplifying the logic for dealing with server-side sorting. Based on this forum discussion.

  • 12

    Avoid Chrome to autocomplete in search field

    In the last months I have seen a lot of users of the platforms we build and use datatables where Chrome browser starts to autofill the input search field of all datatables as it is a login field.

    I have been successfully replicated this behaviour with next steps:

    1. Enable autocomplete functions in Chrome
    2. Using the web application where datatables is installed, I create an account for a new user filling a standard user form.
    3. Chrome ask to save the credentials for future logins, and I click Yes
    4. From that moment all datatables with a search form inside the web application are autocompleted wit the email I use to create the account.
    5. The result is always an empty table, because the search box is already filled with data (the email address) that don't correspond to the table

    The only way I found to prevent this is to wrap the input html filed with a form tag and autocomplete="off" attribute directly on the datatables.js source code. I found some articles that suggest to to this with jquery inside the "initcomplete" function when datatablles finished rendering, but it still fails. I think Chrome is autofilling the field before initcomplete function is triggered, and at that moment it is too late.

    I tested the search functionality after wrapping the field with the form tag and it works ok, I don't detect any problem trying to search elements in the table, and the problem with Chrome is gone.

    Is it possible to wrap the input field with the form tag?

  • 13

    Update ssp.class.php

    Adding a feature to sort by another column.

    columns: [ { name: "id", data: "id"}, { name: "datum", data: "timestamp"}, { name: "countItems", data: "artikelanzahl"}, { name: "amount", data: { _: "amount_display", sort: "amount" }}, { name: "konto", data: "konto"}, ],

  • 14

    Add object response support to render function

    Adding the ability to return a DOM object from the render function instead of just a string.

    I see a similar PR was created. This would help integrate with other frameworks.

  • 15

    Firebird support

    I made some changes to support Firebird syntax, like sql_connect (PDO("firebird:dbname=...), LIMIT = FIRST SKIP (moved position after SELECT statement), add UPPER to filter function