DataTable排序日期不起作用

时间:2017-06-18 03:00:15

标签: css jsp datatable pug

我有以下Jade模板,我用它来设置日期字段的格式。但是,日期排序无法按预期工作。

html
    head
        title= 'Feed List'
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        link(href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.0/flatly/bootstrap.min.css", rel="stylesheet")
        link(href="//cdn.datatables.net/v/dt/dt-1.10.15/datatables.min.css", rel="stylesheet")

    body
        div.container.jumbotron
            h1.header NSE Announcements in last 30 Days
            h3.header Top Annoucements by corporates listed on NSE
        div.container
            script(src='//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')
            script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js')
            script(src='//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js')
            div#dataToShow
                table#resultTable.table.table-hover
                    thead
                        tr
                            th='Ticker'
                            th='Link'
                            th='Date'
                            th='Description'
                        tbody
                            for feed in feedList
                                tr
                                    td= feed.ticker
                                    td
                                        a(href=feed.attachmentLink) #{feed.ticker}
                                    td= moment(feed.dateAdded).format('DD-MM-YYYY HH:MM:SS')
                                    td= feed.purposeText
    script.
        $(document).ready(function() {
        $('#resultTable').DataTable({
            "order": [[ 0, "desc" ]]
            });
        });

问题可能与以欧洲格式投射的日期有关。我通过

修复了它
"columnDefs" : [{"targets":3, "type":"date-eu"}],

但现在只显示10条记录的默认大小似乎不适用于DataTables。

0 个答案:

没有答案