Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82249

Order has changed since version 2

$
0
0

I switched to version 2 last week and since the order is different. Before the order in which the table was created was kept, but now it's not. In the following example the column "Aantal" has the order, but before switching versions, the second order was the column "Datum".

<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="utf-8">
<title>test</title>
<link href="//cdn.datatables.net/2.0.2/css/dataTables.dataTables.min.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="//cdn.datatables.net/2.0.2/js/dataTables.min.js"></script>
<script src="//cdn.datatables.net/plug-ins/2.0.2/filtering/type-based/accent-neutralise.js"></script>
</head>

<body>
    <table id="meeste_achtbanen">
        <thead>
            <tr>
                <th>Achtbanen</th>
                <th>Aantal</th>
                <th>Datum</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><a href="#" class="pretpark" id="59">Energylandia</a></td>
                <td class="center">15</td>
                <td data-order="2021-09-02"><a href="#" class="date" id="2021-09-02">02-09-2021</a></td>
            </tr>
            <tr>
                <td title="Cedar Point, Kennywood"><a href="#" class="pretpark" id="87">Cedar Point</a>, <a href="#" class="pretpark" id="86">Kennywood</a></td>
                <td class="center">13</td>
                <td data-order="2023-07-28"><a href="#" class="date" id="2023-07-28">28-07-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="9">Europa Park</a></td>
                <td class="center">12</td>
                <td data-order="2019-05-01"><a href="#" class="date" id="2019-05-01">01-05-2019</a></td>
            </tr>
            <tr>
                <td title="Haunted Hoochie, Kings Island, Ohio State Fair"><a href="#" class="pretpark" id="88">Haunted Hoochie</a>, <a href="#" class="pretpark" id="90">Kings Island</a>, <a href="#" class="pretpark" id="89">Ohio State Fair</a></td>
                <td class="center">12</td>
                <td data-order="2023-07-31"><a href="#" class="date" id="2023-07-31">31-07-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="93">Six Flags Great America</a></td>
                <td class="center">12</td>
                <td data-order="2023-08-03"><a href="#" class="date" id="2023-08-03">03-08-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="84">Six Flags Great Adventure</a></td>
                <td class="center">11</td>
                <td data-order="2023-07-26"><a href="#" class="date" id="2023-07-26">26-07-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="90">Kings Island</a></td>
                <td class="center">11</td>
                <td data-order="2023-08-01"><a href="#" class="date" id="2023-08-01">01-08-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="9">Europa Park</a></td>
                <td class="center">10</td>
                <td data-order="2020-07-29"><a href="#" class="date" id="2020-07-29">29-07-2020</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="59">Energylandia</a></td>
                <td class="center">10</td>
                <td data-order="2021-08-30"><a href="#" class="date" id="2021-08-30">30-08-2021</a></td>
            </tr>
            <tr>
                <td title="Ferrari Land, PortAventura Park"><a href="#" class="pretpark" id="67">Ferrari Land</a>, <a href="#" class="pretpark" id="66">PortAventura Park</a></td>
                <td class="center">10</td>
                <td data-order="2022-04-30"><a href="#" class="date" id="2022-04-30">30-04-2022</a></td>
            </tr>
        </tbody>
    </table>

    <script>
    $('#meeste_achtbanen').dataTable({
        'order': [[ 1, 'desc' ]],
        'searching': false,
        'paging': false,
        'info': false,
    });
    </script>
    
</body>
</html>

Now I know I can change "order" for this example, but I have tables the rely on the order the table is created in.

 'order': [[ 1, 'desc' ], [ 2, 'asc' ]],

Viewing all articles
Browse latest Browse all 82249

Trending Articles



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