≡

SearchBuilder Requires DateTime when used with dates.

SearchBuilder Requires DateTime when used with dates.

tim1955tim1955 Posts: 8Questions: 4Answers: 0

I am a newbie, and I have worked for 4 hours trying to find a solution. I am sure it is a simple fix, but it eludes me.

I installed DataTables in 2024 on this page:

https://www.timslife.com/PM_Forum/index.php

It works beautifully.
I would like to add a date column. I added a column to my PHP table called SignUpDate and gave it a datetime type.
I understand that DataTables changed SearchBuilder when it is used with dates. And that I must download a new CDN file.
My current CDN files are:

<link href="https://cdn.datatables.net/v/dt/jq-3.7.0/jszip-3.10.1/dt-2.0.3/b-3.0.1/b-colvis-3.0.1/b-html5-3.0.1/b-print-3.0.1/cr-2.0.0/r-3.0.1/rr-1.5.0/sc-2.4.1/sb-1.7.0/sp-2.3.0/sl-2.0.0/sr-1.4.0/datatables.min.css" rel="stylesheet">

The script at the bottom of my HTML page is:

$( document ).ready(function() { $('#mytable').DataTable( { colReorder: { columns: ':not(:first-child)' }, scrollx: true, responsive: { breakpoints: [ {name: 'bigdesktop', width: Infinity}, {name: 'meddesktop', width: 1480}, {name: 'smalldesktop', width: 1280}, {name: 'medium', width: 1188}, {name: 'tabletl', width: 1024}, {name: 'btwtabllandp', width: 848}, {name: 'tabletp', width: 768}, {name: 'mobilel', width: 480}, {name: 'mobilep', width: 320} ] }, layout: { top1: 'searchBuilder', bottom2Start: 'buttons' }, buttons: ['copy', 'pdf', 'excel'] } ); });

My questions are - what boxes do I need to click on the downloads page to get updated CDN links to upgrade my CDN to include datetime for searchbuilder?
And do I need to update the script at the bottom of my page?

Please also let me know if I should be using a different type for my datetime field in the PHP table.

Many Thanks for your patience and understanding.

Best Regards,
Tim Brockett

Answers

  • kthorngrenkthorngren Posts: 22,506Questions: 26Answers: 5,171

    Open the link you posted and it will provide a URL you can use to upgrade, for example:

     * To rebuild or modify this file with the latest versions of the included
     * software please visit:
     *   https://datatables.net/download/#dt/jq-3.7.0/jszip-3.10.1/dt-2.0.3/b-3.0.1/b-colvis-3.0.1/b-html5-3.0.1/b-print-3.0.1/cr-2.0.0/r-3.0.1/rr-1.5.0/sc-2.4.1/sb-1.7.0/sp-2.3.0/sl-2.0.0/sr-1.4.0
    

    At that line aadd the DateTime extension. Does that resolve your issue?

    Kevin

  • allanallan Posts: 66,060Questions: 1Answers: 10,999 Site admin

    As Kevin says, follow that link and add DateTime to the list.

    You are updating from v2 though, so it might be worth reviewing the v3 upgrade documentation.

    Another quick fix option would be to just add DataTime to your page:

    <link href="https://cdn.datatables.net/datetime/1.6.3/css/dataTables.dateTime.min.css" rel="stylesheet" />
    <script src="https://cdn.datatables.net/datetime/1.6.3/js/dataTables.dateTime.min.js"></script>
    

    Add that after your existing DataTables JS include in the HTML. This code using DateTime 1.6.3 which is compatible with DataTables 2, so it should work fine, although I should say that v2 is now legacy and only supported with support packages.

    Allan

Sign In or Register to comment.