Quantcast
Channel: Recent Discussions — DataTables forums

columnControl searchList not working for Booleans and numbers

$
0
0

Link to test case: https://live.datatables.net/tiwevaji/1/
Description of problem:

The columnControl searchList option is not working for Boolean data types and number data types.

The test case https://live.datatables.net/tiwevaji/1/ demonstrates this issue.

Data Type Search Number Search Text Search List
Number
Boolean -
Text -

Observations:
The searchList correctly lists the options for all data types.

However, selecting an option from the searchList does not filter the table for Boolean and number data types.

Link to Ajax data: https://dummyjson.com/todos




Allow empty or existing value not in list when submit editor form

$
0
0

I have a <select> list in records from the main db publikasjon with values from a field isbn.litt_isbn. I pick the first available (=0) value from the DB field as an option and after submitting it is marked used (=1). This works. But I want to be able to accept existing field value and also no(empty) value. I have problems getting theValidate::: working and I get an error when submitting

<b>Fatal error</b>
:  Uncaught Error: Call to a member function optional() on string in /home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor/Validate.php:174
Stack trace:
#0 /home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor/Validate.php(1032): DataTables\Editor\Validate::_common('\xEF\xBB\xBF978-82-345-0...', 'isbn')
#1 /home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor/Field.php(778): DataTables\Editor\Validate::DataTables\Editor\{closure}('\xEF\xBB\xBF978-82-345-0...', Array, Object(DataTables\Editor\Field), Array)
#2 /home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor.php(848): DataTables\Editor\Field-&gt;validate(Array, Object(DataTables\Editor), '4096')
#3 /home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor.php(1071): DataTables\Editor-&gt;validate(Array, Array)
#4 /home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor.php(716): DataTables\Editor-&gt;_process(Array)
#5 /home/1/m/mfu/www/code/js/Editor-PHP/controllers/upload-mfu.php(118): DataTables\Editor-&gt;process(Array)
#6 {main}
  thrown in <b>/home/1/m/mfu/www/code/js/Editor-PHP/lib/Editor/Validate.php</b>
on line <b>174</b>
<br/>

Her is the field in js:

{
    label: 'ISBN:',
    name: 'publikasjon.litt_isbn',
    type: "select",
    placeholder: 'Ingen ISBN valgt',
    placeholderDisabled: false
},                   //other fields after this...

And the php code for the field:

Field::inst( 'publikasjon.litt_isbn' )
            ->options(function($db, $field) {
                $options = [];
                // Get the first available ISBN with status = 0
                $row = $db
                    ->query('select')
                    ->get(['isbn'])
                    ->table('isbn')
                    ->where('status', 0)
                    ->order('id ASC')
                    ->limit(1)
                    ->exec()
                    ->fetch();

                if ($row) {
                    $options[] = [
                        'label' => $row['isbn'],
                        'value' => $row['isbn']
                    ];
                }

                // Safely get the current value
                $current = null;
                if ($field !== null && method_exists($field, 'val')) {
                    $current = $field->val(); 
                }

                // If it's not the same as the one above, and it's not already in the list, add it
                if (!empty($current) && (!isset($row['isbn']) || $row['isbn'] !== $current)) {
            $options[] = [
                'label' => $current . ' (tidligere valgt)',
                'value' => $current
            ];
        }
                return $options;
                })
                ->validator(
                Validate::dbValues('isbn', 'isbn'),
                ValidateOptions::inst()->allowEmpty(true)
            )
        ,

Is this the correct way to do the sql to get the first field? I thin there is something I dont have correct in the Validate part but I can not find it out. So my goal is 1) Show current value if exists and accept it 2) Show first available number from isbn.isbn field. 3) Accept empty value on submit

Can't sort on 1 specific column

$
0
0

I use PHP Server Side (Ozdemir Library) for the back-end of the table:

SELECT 
        l.LK_ID as id, 
        d.LK_ID as secondid, 
        LK_KLANTNR, 
        LK_KYC as KYC_STATUS,
        p.name as LK_AFFILIATE, 
        LK_NAAM, 
        LK_NAAM as LK_BEDRIJFSNAAM, 
        ......
        //loads more data
        FROM `licenties` l 
        INNER JOIN `partners` p 
        on l.LK_AFFILIATE = p.id 
        INNER JOIN details d 
        ON d.LK_ID = l.LK_ID
        ORDER BY l.LK_KLANTNR DESC

The front-end uses typescript:

.DataTable({
      serverSide: true,
      searchDelay: 1000,
      processing: true,
      responsive: true,
      autoWidth: false,
      //   editor: editor,
      rowId: "id",
      dom: "Bfrtip",
      ajax: "datatables/clients.php",
      columns: [
        {
          data: "id",
          visible: false,
          searchable: false,
          orderable: false,
        },
        {
          data: "LK_KLANTNR",
          responsivePriority: 2,
        },
        {
          data: "LK_NAAM",
          responsivePriority: 3,
        },
        {
          data: "LK_PLAATS_BEDRIJF",
          responsivePriority: 6,
        },
        {
          data: "LK_AFFILIATE",
          responsivePriority: 5,
        },
        {
          data: "KYC_STATUS",
          // biome-ignore lint/suspicious/noExplicitAny: no typing available or known
          render: (data: string, type: string, row: any, meta) => {
          //render translations and type checks
            }
          },
          responsivePriority: 1,
        },
        {
          data: "LK_KLANTNR",
          // biome-ignore lint/suspicious/noExplicitAny: no typing available or known
          render: (data: string, type: string, row: any) => {
           //render tooltips
          },
          responsivePriority: 4,
        },
      ],
      order: [[1, "desc"]],
      //   rowGroup: {
      //     dataSrc: "LK_AFFILIATE",
      //   },
      language: {
        url: locale.datatablesTranslationLink(),
      },
      select: {
        style: "single",
      },
      buttons: [
        //lots of buttons and functions
      ],

When I use set the order voor column 0 or 2 it works fine. But somehow when trying the same for column 1 it seems to go back to basic behaviors.

The object I get returned for a row looks as follows in the inspect browser tab:

{
    "id": "18143",
    "secondid": "18143",
    "LK_KLANTNR": "18143",
    "KYC_STATUS": "KYC_COMPLEET",
    "LK_AFFILIATE": "ERA IT B.V.",
    "LK_NAAM": "De Specialisten Groep B.V.",
    "LK_BEDRIJFSNAAM": "De Specialisten Groep B.V.",
    "LK_STATNAAM": "De Specialisten Groep B.V.",
//lots more properties
}

The id can be the same as the LK_KLANTNR but also different (depending on the system that created the data in the first place) so I am supposed to change the order of the rows to follow the LK_KLANTNR as opposed to the id.

Is the problem in the fact that I am trying to sort server-side data?

I have tried changing the rowId to LK_KLANTNR and changing the SQL ORDER BY to GROUP BY. As you can see I have disabled the rowGroup. When I try to sort on column 1 it always seems to group the data for the LK_AFFILIATE field with or without the rowGroup statement and sort on id ascending. This is not the case when trying to sort on column 0 or 2. Again seems to be the basic behaviour of the SQL statement.

Sorry for any spelling mistakes, English is not my native language.

pdfHtml5 button to send table via PHPMailer

$
0
0

Hi all,
I have partially succeeded with creating a send button to post filtered editor table data (using predefined search criteria) to phpmailer. The message comes thru, but the attachment file only contains "true".
Here is my code. Any help would be greatly appreciated.
Thanks,
Miklos

topStart: {
            buttons: [ 
                {
    extend: 'pdfHtml5',
    text: 'Send as PDF',
    title: 'DataTable Export',
    customize: function (doc) {
      // optional: customize PDF
    },
    action: function (e, dt, button, config) {
      let pdfDoc = window.pdfMake.createPdf(config);
      pdfDoc.getBlob(function (blob) {
        let formData = new FormData();
        formData.append("pdf", blob, "datatable.pdf");

        // send PDF to server via AJAX
        fetch("send_pdf_email_koppan.php", {
          method: "POST",
          body: formData,
        })
        .then(response => response.text())
        .then(result => alert("Email sent: " + result))
        .catch(error => alert("Error: " + error));
      });
    }
  },

Event when DT is really ready?

$
0
0

I was wondering if there's an event which I can hook into when DataTables is really finished loading.

I know we can use initComplete or $table.ready() but those events/functions fire before row rendering has completed.
The draw() event fires many times during rendering which is also not very helpful.

My case:
I load data through AJAX and render rows with some rendering functions. In that row rendering I create buttons on which I want to hook some events. However the buttons are only rendered after initComplete and ready.

Ajax-sourced data not showing active states on reload (see your example)

$
0
0

Hi Team,

I've noticed an issue in your example page that reflects a similar issue I am having within my own application.

On that page, here are the steps to follow:

  1. Create two or three states.
  2. Select one of the states and you should see that it's highlighted as the active state (checkmark next to the active state)
  3. Reload the page (your saved states should still be present)
  4. Click on one of the states. You should see that it's not highlighted as an active state. (no checkmarks)
  5. Create a new state. You should see that new state is highlighted (has checkmark)
  6. Click one of the other states you created previously, they won't highlight to indicate they're the active state. (no checkmark)
  7. Go back to the state you just created (checkmark is present)

Here is a video of the example page where this is occurring.

Thoughts on how to have DataTables recognize the active state on ajax-sourced data after a page reload?

Thanks,

Tanner

Pagination without ellipses

$
0
0

Hi Currently I am using database plugin //cdn.datatables.net/plug-ins/2.3.1/pagination/full_numbers_no_ellipses.js which i got from the url https://datatables.net/plug-ins/pagination/full_numbers_no_ellipses.
when i added the plugin in package .json and imported in to my typescript file the build ran successfully without errors
but the debug console output is showing
cannot read properties of undefined 'fn'.
But I am not getting the desired output which should be pagination numbers without ellipses

Any suggestions will be welcome

columnControl: pre load columnControl values when using searchList

$
0
0

Looking at the "Options via Ajax only" example it shows how searchList dropdowns can be populated by values returned in columnControl when the table is loaded via ajax.

This is nice, but for my requirement I already know what specific items I want in each dropdown and because I'm using ajax I want them to stay the same, even if the values do not currently exist in the corresponding column of the currently rendered table.

Is there a way of pre-loading the values in columnControl rather than them being returned with every ajax request and thus reducing the size of the response?


Vue3 ColumnControls custom content

$
0
0

How to describe new custom content in vue3? Tried few different ways but always ended at no registered myButton class.

<template>
    <div class="card-body p-3">
        <DataTable class="table table-sm table-hover" :options="lcOptions" ref="table">
        </DataTable>
    </div>
</template>
<script setup lang="ts">
    import DataTable from 'datatables.net-vue3';
    import DataTablesLib, { type Config } from 'datatables.net-bs5';
    import 'datatables.net-buttons/js/buttons.html5';
    import 'datatables.net-buttons';
    import 'datatables.net-fixedcolumns-bs5';
    import ColumnControl from 'datatables.net-columncontrol';
    import jszip from 'jszip';
    import type { LayoutKey } from '#build/types/layouts';

    const { options, layout } = defineProps<{
        options: Config,
        layout?: Partial<Record<LayoutKey, any>>
    }>();
    const toolbar = ref();
    const table = ref();

    DataTable.use(DataTablesLib);
    DataTablesLib.Buttons.jszip(jszip);

    DataTablesLib.ColumnControl = ColumnControl;

    if (!DataTablesLib.ColumnControl.buttons) {
        DataTablesLib.ColumnControl.buttons = {};
    }

    DataTablesLib.ColumnControl.buttons.myButton = {
        defaults: {
            text: 'My Button'
        },
        init: function (config: any) {
            const button = document.createElement('button');
            button.className = 'btn btn-primary';
            button.textContent = config.text;
            button.addEventListener('click', () => {
                alert('You have clicked my button!');
            });
            return button;
        }
    };

    const columnControl = [{
        target: 0,
        content: [
            'order',
            {
                extend: 'dropdown',
                text: 'Columns',
                content: ['colVis']
            }
        ]
    }, {
        target: 1,
        content: [{ extend: 'myButton' }]
    }];

    const lcOptions: Config = {
        columnControl,
        ordering: {
            indicators: false,
            handler: false
        },
        stateSave: false,
        scrollX: true,
        scrollCollapse: true,
        processing: true,
        serverSide: true,
        pageLength: 50,
        buttons: ['csv', 'copy', 'excel'],
        layout: {
            topStart: null,
            topEnd: null,
            top: () => toolbar.value,
            ...layout
        },
        ...options
    }

</script>

Datatable 2.0 and responsive: Cannot read properties of null (reading '_details')

$
0
0

Link to test case: https://live.datatables.net/wuraxuci/7/edit

Error messages shown:
VM1902 dataTables.js:8076 Uncaught TypeError: Cannot read properties of null (reading '_details')
at HTMLTableElement.<anonymous> (VM1902 dataTables.js:8076:15)
at HTMLTableElement.dispatch (VM1900 jquery-3.7.1.min.js:2:40035)
at v.handle (VM1900 jquery-3.7.1.min.js:2:38006)
at Object.trigger (VM1900 jquery-3.7.1.min.js:2:70124)
at ce.fn.init.triggerHandler (VM1900 jquery-3.7.1.min.js:2:70811)
at _fnCallbackFire (VM1902 dataTables.js:6273:50)
at _fnAdjustColumnSizing (VM1902 dataTables.js:2140:3)
at _Api.<anonymous> (VM1902 dataTables.js:8552:4)
at _Api.iterator (VM1902 dataTables.js:6672:15)
at _Api.<anonymous> (VM1902 dataTables.js:8551:15)

Description of problem: this stopped working after updating to 2.0. Basically i have 2 tables. Each row ends with a + button. If the user clicks on it the item gets moved to table 2. If the table is fully opened it works fine but if you resize the window and click on the button you get the above error in console.

I use a function to get the row

function getDatatableTriggeredRow(trigger_el) { if (trigger_el.closest('li').length) { return trigger_el.closest('tr').prev('tr'); } else { return trigger_el.parents('tr'); } }

and it works fine in every page i use it except for this particular case.

Weird column count issue

$
0
0

Link to test case: Internal system so I can't really give you a usable link.

===========================================

Debugger code (debug.datatables.net): I got a 403 error when I hit the button so I pasted it here below.

===========================================

Error messages shown: No errors are shown - simply the tables rows are not displayed as if there are no rows (the data source has data).

===========================================

Description of problem: From some reason I fail to add another column.
I currently have 7 columns and I wish to add another one, but once I do it fails to display the data.
In the code pasted below you can see a column is commented - as long as it is commented the data is displayed.
Once I uncomment the column no data is being displayed and I get a message of no data to display.

I know it is a weird issue but I really hope you have an idea on this.

mazemate_crm_engine.serviceCallsDataTable = jQuery('div.service-calls-list-container table').DataTable( {
    data: dataForTable,
    paging: false,
    fixedHeader: true,
    scrollCollapse: true,
    scrollY: '50vh',
    columns: [
        {
            className: 'dt-control',
            orderable: false,
            data: null,
            defaultContent: '',
        },
        { data: 'created_at', title: 'date', className: 'dt-header-style', type: 'date' },
        { data: 'service_id', title: 'service id', className: 'dt-header-style', type: 'integer' },
        { data: 'area', title: 'area', className: 'dt-header-style', type: 'string' },
        { data: 'type', title: 'type', className: 'dt-header-style', type: 'string' },
        { data: 'descriptionShort', title: 'description', className: 'dt-header-style', type: 'string', width: '140px' },
        // { data: 'closed', title: 'date closed', className: 'dt-header-style', type: 'date' },
        { data: 'status', title: 'status', className: 'dt-header-style', type: 'string', sorting: false, visible: false },
    ],
    order: {
        name: 'created_at',
        dir: 'desc'
    }
} );

function format(d) {
    return (
        '<div class="extra-information">' +
        '<div class="extra-information-piece"><span>service_id:</span><span>' + d.service_id + '</span></div>' +
        '<div class="extra-information-piece"><span>created_at:</span><span>' + d.created_at + '</span></div>' +
        '<div class="extra-information-piece"><span>contact:</span><span>' + d.contact + '</span></div>' +
        '<div class="extra-information-piece"><span>owner:</span><span>' + d.owner + '</span></div>' +
        '<div class="extra-information-piece"><span>area:</span><span>' + d.area + '</span></div>' +
        '<div class="extra-information-piece"><span>type:</span><span>' + d.type + '</span></div>' +
        '<div class="extra-information-piece"><span>request:</span><span>' + d.request + '</span></div>' +
        '<div class="extra-information-piece"><span>descriptionFull:</span><span>' + d.descriptionFull + '</span></div>' +
        '<div class="extra-information-piece"><span>status:</span><span>' + d.status + '</span></div>' +
        '<div class="extra-information-piece"><span>closed:</span><span>' + (d.closed == null ? '' : d.closed) + '</span></div>' +
        '</div>'
    );
}

mazemate_crm_engine.serviceCallsDataTable.on('click', 'td.dt-control', function (e) {
    let tr = e.target.closest('tr');
    let row = mazemate_crm_engine.serviceCallsDataTable.row(tr);
 
    if (row.child.isShown()) {
        // This row is already open - close it
        row.child.hide();
    }
    else {
        // Open this row
        row.child(format(row.data())).show();
    }
});

===========================================

Table information
Summary information about the DataTables on this page.
Information about 1 table available

DataTables_Table_0

Data source: Ajax
Processing mode: Client-side
Draws: 2
Columns: 8
Rows - total: 25
Rows - after search: 0
Display start: 0
Display length: 10
Version check
Check to see if your page is running the latest DataTables software.
LibraryInfoInstalledLatest
DataTablesUp to date2.3.22.3.2
AutoFill-2.7.0
Buttons-3.2.3
ColReorder-2.1.1
ColumnControl-1.0.6
Editor-2.4.2
FixedColumns-5.0.4
FixedHeader-4.0.3
KeyTable-2.12.1
Responsive-3.0.4
RowGroup-1.5.1
RowReorder-1.5.0
Scroller-2.4.3
SearchBuilder-1.8.2
SearchPanes-2.3.3
Select-3.0.1
Check for common issues
Run automated tests to check for common and previously reported issues.
16 tests complete. No failures or warnings found!

If you are having problems with your DataTables, please upload a data profile using the Upload option below, and post a support request in DataTables forums, with a link to a page showing the issue so we can help to debug and investigate the issue.
Upload configuration data
Upload your table's configuration and data to allow for further analysis.
It can often greatly assist in debugging a table if we can see the configuration and data in the table. This feature of the debugger will read your local DataTables configuration and upload it to debug.datatables.net for inspection.

Important: The data uploaded to the server can only be viewed by SpryMedia employees will be automatically deleted after two weeks. The data will never be sold or otherwise published. It is used for debugging any issues you are experiencing with DataTables only.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

TypeError in ColumnControl v1.0.6 when handling null values

$
0
0

Link to test case: https://live.datatables.net/reluqabe/1/
Link to Ajax data for test case: https://dummyjson.com/c/1e17-073c-43a5-9cca

Description of problem:

When using DataTables ColumnControl v1.0.6, a TypeError occurs when the table contains null values and the columnControl's searchlist feature attempts to process these values:

Uncaught TypeError: Cannot read properties of null (reading 'toString')
    at L (datatables.min.js:44:24350)

Steps to Reproduce:

Initialize DataTable with columnControl and searchlist enabled
Have data containing null values in columns
View the developer console to observe error message

Root Cause Analysis
The error occurs because fastData() can return null values, but the code attempts to call toString() on these values without checking for null first.

Reference commit Fix: Non-string data types could cause -content searchList to not match selected options.:
https://github.com/DataTables/ColumnControl/commit/416af3c276c0485565e5fc9476ecf478f74b7b6d

let filter = settings.fastData(rows[i], idx, 'filter').toString();

Suggested Fix:
The plugin should implement null checks before calling toString() on values. In the searchList.ts source, this would look like:

var filter = settings.fastData(rows[i], idx, 'filter');
filter = filter !== null ? filter.toString() : '';

SearchPanes custom Order

$
0
0

I am currently creating a Custom Search pane with Custom Options. I have it working but it is completely ignoring the Order value. I've created several on the same Datatable manually typing out an array, but in this instance I'm gathering the options from an ajax call before the datatables is loaded.

success: function (response) {
                response.forEach(function(role) {
                    unverifiedOptions.push({
                        label: role.name,
                        value: function (rowData, rowIdx) {
                            return rowData["unverifiedRoles"] && rowData["unverifiedRoles"].includes(role.name);
                        },
                        order: role.order
                    });
                });

            }

Then in the search panes:

Again, this works, it filters the data as intended, but the order in the SearchPane lists the order in this order:
10-19 (in order) then lists 2-9 (in order).

I thought maybe it was doing a string sort, so I did a parseInt(role.order) and it had no affect.

I'm a little confused.

the datatable field does not highlight selected rows

$
0
0

Good morning,
I have a problem that I cannot understand.
I use the datatable field in a web page and it works correctly:

In another menu, the same configuration does not highlight selected items:

The same page works regularly using checkbox selection:

Apparently the supporting js files are the same.
What should I check?
Thank you,
Giuseppe

columnDefs how to target _all except one target without naming every index

$
0
0

I have my columnDefs with some targets like that

columnDefs: [
{
targets: [-1],
className: 'dt-center',
orderable: false
},
{
className: 'dt-head-center dt-body-left',
targets: ['_all']
}

    ],

but i want to all target to have the className: 'dt-head-center dt-body-left' and the last column to not have this class and have only the dt-center.
Its there a way to do that without naming every index like [0,1,2,3,4,5,6]?


Why does server-side callback param need old format?

$
0
0

New to DataTables, and I've been experimenting with version 2.3.2. I have server-side data-handling working, having one test page that uses an MVC controller, while a separate page (Blazor) uses a jsInterop circuit. With the MVC controller everything works as expected. However, with the jsInterop circuit I had to do some slight (but unexpected) fiddling to get it to work as expected (see the red square below):

As one can see, the json fetched from the server has "data", "draw", "recordsTotal", and "recordsFiltered" (exactly the same as what works in the case of the MVC controller) , but here the callback function insists on the old format, and when I give it the old format, it's happy and everything works as expected. Is this a bug, or is there something about my code that is (in effect) telling DT to insist on the old data format? It's a slightly niggly thing, but I'd like to sort this out.

Thanks,
Ross

Sorting arrows now positioned on the left of the rightmost column headings

$
0
0

I note that the examples now show the sorting arrows of the rightmost column headings positioned to the left rather than to the right, as previously. In which version was this change introduced and which lines in the style sheet need to be modified to revert to the traditional behaviour? Is any user control possible on the number of columns so affected? Thanks in advance.

Added buttons CSS and JS, but Print button does not appear

$
0
0

I have DataTables working in my Django project and all of the functionality works fine. Now, I am trying to use the **buttons **extension to include a "print" button. My JQuery is set as follows...

<script type="text/javascript">

    $(document).ready(function () {
        $('#setupTable').DataTable({
            'buttons': ['print']
        });
    });
</script>

The header section of my code includes the following...

<script src="https://cdn.datatables.net/2.3.2/js/dataTables.min.js"
        integrity="sha384-RZEqG156bBQSxYY9lwjUz/nKVkqYj/QNK9dEjjyJ/EVTO7ndWwk6ZWEkvaKdRm/U"
        crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/2.3.2/js/dataTables.bootstrap5.min.js"
        integrity="sha384-G85lmdZCo2WkHaZ8U1ZceHekzKcg37sFrs4St2+u/r2UtfvSDQmQrkMsEx4Cgv/W"
        crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/buttons/3.2.3/js/dataTables.buttons.min.js"
        integrity="sha384-zlMvVlfnPFKXDpBlp4qbwVDBLGTxbedBY2ZetEqwXrfWm+DHPvVJ1ZX7xQIBn4bU"
        crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/buttons/3.2.3/js/buttons.bootstrap5.min.js"
        integrity="sha384-BdedgzbgcQH1hGtNWLD56fSa7LYUCzyRMuDzgr5+9etd1/W7eT0kHDrsADMmx60k"
        crossorigin="anonymous"></script>

The functionality of the datatable still works (paging, searching, sorting, etc.), however no print button appears. I have watched a few videos to see if I'm doing it correctly, and it seems that I am.

Can anyone offer some advice on what might be wrong here?

Thanks!

Download builder URLs break after any single package gets a patch release

$
0
0

Link to test case:

https://datatables.net/download/builder?dt/dt-2.3.2/b-3.2.3/b-html5-3.2.3/fh-4.0.2

Error messages shown:

curl -I https://datatables.net/download/builder?dt/dt-2.3.2/b-3.2.3/b-html5-3.2.3/fh-4.0.2

HTTP/2 200
date: Fri, 27 Jun 2025 14:42:46 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
expires: Thu, 19 Nov 1981 08:52:00 GMT
cache-control: no-store, no-cache, must-revalidate

curl https://datatables.net/download/builder?dt/dt-2.3.2/b-3.2.3/b-html5-3.2.3/fh-4.0.2

Error: Only libraries of the current release version can be used by the. package builder. The library FixedHeader's current release version is 4.0.3. Please reload the download builder page to have it use the latest libraries.

Description of problem:

I'm not sure if this is a problem per se, or just mismatched expectations on my part… I get that what the download builder has to do, in terms of the many permutations of libraries with extensions, is pretty incredible as it is, and that I am essentially reverse-engineering a URL out of the download builder in a way that maintainers probably didn't envision.

But it seems like patch releases and minor releases should be retained for a while, so that the URL of a pre-built download can depended on to work for a while, e.g. in an automated deployment scenario, or in a CI/CD config.

What happens currently is that download URL stops working, but it doesn't return an 400 or a 404 Not Found either, so it's more of a challenge to catch that error (than just, say, inspecting a return code from curl).

Is there some better way of accomplishing what I'm trying to accomplish — stable downloads, without the need to install Node.js or use NPM?

Would it be possible to keep all minor versions around in the S3 bucket or wherever all these are stored, instead of removing them and breaking the URL when any package has a patch-level release?

Small python module for creating Datatables - df2tables

$
0
0

I created a python module that converts data frames (python structure for data analysis) to Datatables.

It may be useful for some people.

Docs, demo:

df2tables

It is generally surprising how large datasets (100k rows+) can be browsed and still be responsive! This confirms how well built Datatables are.

It turns out that it is useful for browsing e.g. training data for ML algorithms.

Many thanks to Allan for creating such a great open source tool.

Sort arrow position (before or after ?)

$
0
0

Hello dear datatables team,

I'm trying to upgrade an old site using an old datatables version from 1.10 to 2.3.2. The upgrade seems fine until here except that I discovered a new behavior that I can't explain.

It's about orderable columns. On some columns the sort arrow are displayed after the column text but on some columns the sort arrows are displayed after.

After several tests it seems due to the fact the ordered data are strings or numbers.

Is it a bug due to the upgrade or a feature ? Is there a way to tell Datatables to display the sort arrows in the same way for all columns ?

Please note that I'm using Bootstrap 3.4.1.

Thanks !

Dynamically assign column headers

$
0
0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
I have a dataset, based on an Oracle query, where column names and counts might change.
Is there a way to create a jQuery datatable based on this changing dataset?
I don't want to manually add/remove/update column headers as query gets updated.

Dataset is result of a query like this:

select metric,
listagg(case when site_name = 'X' then TS end) X,
listagg(case when site_name = 'Y' then TS end) Y
from whatever;

With dataset looking like:

metric    X    Y
blah      1    4

And later it might have an added column:

select metric,
listagg(case when site_name = 'X' then TS end) X,
listagg(case when site_name = 'Y' then TS end) Y,
listagg(case when site_name = 'Z' then TS end) Z
from whatever;

resulting in:

metric    X    Y    Z
blah      1    4    2

I know I can change column header if I know what it is, like:

$(document).ready(function () {
    vat table = $('#example').DataTable()'

    $('#example thead th:eq(0)').html('new column header');
}

Sort icons in version 2.3.2

$
0
0

In my application, I'm using Bootstrap 4.5.2 and DataTables 2.3.2. Everything works except the display of the "sort asc" and "sort desc" icons in the table header. If I use version 2.3.0, everything works perfectly, including the sort icons. Has anyone else experienced this issue?

Data Type seems to be detected from the data-order rather than the actual data

$
0
0

I have a row like this:
<tr>
<th>Information</th>
</tr>
<tr>
<td data-order="1699675200" class="dt-type-numeric sorting_1"><a href="page?id=123">Text</a>
</td>
</tr>.....
When the table is rendered it gets the 'dt-type-numeric sorting_1' class which makes it right-justified. Since it is visible text, I want it to be left-justified, even though the data to sort on is numeric.
The workaround I found is to simply add a letter to look like this: data-order="x1699675200", but that may mess up the sort. Is there a better way?

Keyup event not firing for individual column filters

$
0
0

Link to test case: https://live.datatables.net/ronajuxi/1/edit?html,css,js,output
Debugger code (debug.datatables.net): Debugger produced nothing when I ran it - almost as if it did not run. I have run it successfully on other samples
Error messages shown: No error messages shown
Description of problem:
I am using the example provided here to filter by individual column: https://datatables.net/extensions/fixedcolumns/examples/styling/col_filter.html

The only thing I changed was moving the filtering inputs to the top of the table. Everything seems to be working except the keyup event. That even wasn't firing even when all the inputs were in the footer. I've not had much luck looking for solutions online or in the forums. What am I missing here?

Missing translation options for ARIA attributes

$
0
0

Hi,

there are missing options to translate some of the ARIA attributes which are used and should be translated into other languages.

These are missing on the contribute editor:

aria.orderable
aria.orderableReverse
aria.orderableRemove

=> https://datatables.net/plug-ins/i18n/

Please add them so we can translate them into languages as well.

Thanks :-)

Chat GPT-generated DataTables Configs – Helpful or Risky in Production?

$
0
0

Hi all,

I’ve been experimenting with using ChatGPT to generate more complex DataTables configurations – for example combining serverSide, rowGroup, responsive, and buttons. It often gives me a working base really fast, especially when I don’t want to comb through the docs for every option.

But I’ve noticed something: sometimes it uses outdated syntax, or omits edge-case settings that cause issues when used in production (like incorrect ajax structure, or missing columns.render functions when needed).

So I'm curious:
- Has anyone here tried using ChatGPT (or other LLMs) to generate or validate their DataTables setup?
- Do you trust those outputs in production code?
- Are there particular config areas where AI-generated code tends to fail or mislead?

Would love to hear your experiences — especially if you've seen ChatGPT give bad advice that looked fine at first glance.

Thanks!

Minor request: Bootstrap floating labels for table controls

$
0
0

The Bootstrap floating labels are available for Editor fields, but it would also be a nice feature if that styling were available on the DataTables controls as well, such as Search and PageLength, etc.

initComplete event not fired because of an error

$
0
0

Hi, I'm struggling with an error I can't understand

If the error is logged in console, the initComplete event doesn't get fired.

Looking at dataTables.min code, I see 2 executions of this code

the first time it seems to be ok ~~~~even if o[0] is undefined

the second time the array o contains the div.dt-autosize

but then comes the error

I noticed also multiple dataTables_Table_[n]_wrapper

that lead into this

It seems there are more nested dataTables, is it right?

I have also this kind of error

during the iteration on colums

that provokes the behavior in the video

@allan do you have some idea?


DateTime time only picker - default minute selection

$
0
0

I am using the standalone DateTime extension with luxon, set to format HH:mm.

When you select an hour first, the minute selection defaults to the current time. Am I able to set a default to 00? If not, would a feature like this be considered?



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>