jQuery DataTableS错误排序

发布于 2025-02-08 03:55:22 字数 657 浏览 1 评论 0原文

我在jQuery DataTable排序方面有问题。它以错误的顺序排序。例如:我的数字从1到5,当我单击以按随机顺序排序该列时:4、1、3、5、2。它不仅具有数字类型。字符串,日期 - 相同的问题。我在MySQL数据库中有数据,并以JSON格式获得了数据。我的数据表代码:

var dataTable = $('#user_data').DataTable({
    "processing" : true,
    "serverSide" : true,
    "order" : [],
    "ajax" : {
        url:"data_control/orders/fetch.php",
        type:"POST"
    },
    "drawCallback": function( settings ) {
        paint();
    },
    columnDefs: [
        { 
            "orderable": false, 
            targets: [11, 12, 13, 14]
        }
    ]
});

正如我已经提到的 - 我以JSON格式从fetch.php文件中选择数据库。有什么想法如何解决我的分类问题? 谢谢!

I have a problem with jQuery dataTable sorting. It sorts columns in wrong order. For example: I have numbers from 1 to 5, when I click to sort that column it sorts in random order: 4, 1, 3, 5, 2. It's not only with number type. String, date - same problem. I have my data in MySQL database and I get it in json format. My datatable code:

var dataTable = $('#user_data').DataTable({
    "processing" : true,
    "serverSide" : true,
    "order" : [],
    "ajax" : {
        url:"data_control/orders/fetch.php",
        type:"POST"
    },
    "drawCallback": function( settings ) {
        paint();
    },
    columnDefs: [
        { 
            "orderable": false, 
            targets: [11, 12, 13, 14]
        }
    ]
});

As I already mentioned - I select my data from database in fetch.php file in JSON format. Any ideas how to solve my problem with sorting?
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文