DataTable RRS feed

  • Question

  • User-797751191 posted


      What is difference in columnDef & aoColumnDefs in Jquery Datatable


    Tuesday, July 2, 2019 6:57 AM

All replies

  • User665608656 posted

    Hi jsshivalik,

      What is difference in columnDef & aoColumnDefs in Jquery Datatable

    The difference is that aoColumnDefs has a higher priority than columnDefs.

    No matter which attribute you set first, the final rendering effect of the table comes from aoColumnDefs.

    This is the definition of these two parameters :https://datatables.net/reference/option/columnDefs


    In fact ,there is no substantial difference between them, their purpose is to set the column properties of the table.

    I have made an example about these two parameters:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css" />
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
        <script type="text/javascript">
            $(function () {
                    aoColumnDefs: [
                        { targets: [0, 1], visible: false }
                    columnDefs: [
                        { targets: [0, 1], visible: true }
        <form id="form1" runat="server">
            <div style="width: 800px; height: 200px;">
                <table id="example" class="display" style="width: 100%">
                            <th>Start date</th>
                            <td>Tiger Nixon</td>
                            <td>System Architect</td>
                            <td>Garrett Winters</td>
                            <th>Start date</th>

    The result of this work demo:

    Best Regards,


    Tuesday, July 2, 2019 9:13 AM