开发者

Ids get ordered alphabetically instead of numerically

开发者 https://www.devze.com 2022-12-13 15:25 出处:网络
I am pulling out data from MySQ开发者_高级运维L ordered by id, which is 1,2,3 and there is no problem.

I am pulling out data from MySQ开发者_高级运维L ordered by id, which is 1,2,3 and there is no problem.

However when I use it with http://www.datatables.net/, the order becomes 1, 10, 11 ,12,..

I am not able find any parameter to sort this problem.

I am wondering if anyone knows how to fix this.

$(document).ready( function() {
    $("#tablesorter").dataTable( {
        "iDisplayLength": 40,
                "oLanguage": {
            "sLengthMenu": 'Display <select>'+
                '<option value="20">20</option>'+
                '<option value="40">40</option>'+
                '<option value="60">60</option>'+
                '<option value="80">80</option>'+
                '<option value="100">100</option>'+
                '<option value="-1">All</option>'+
                '</select> records'
        }
    } );
} )


It sounds like you need to set the column type of that column to numeric, in order for the sort to work correctly. This is detailed at the data tables website

0

精彩评论

暂无评论...
验证码 换一张
取 消