Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用某些文本和数字组合时,DataTable排序不正确_Jquery_Sorting_Datatables - Fatal编程技术网

Jquery 使用某些文本和数字组合时,DataTable排序不正确

Jquery 使用某些文本和数字组合时,DataTable排序不正确,jquery,sorting,datatables,Jquery,Sorting,Datatables,我有一个jQuery数据表,配置如下: $('#invoiceListing').dataTable({ "aaSorting": [[0, "desc"]], "bPaginate": false, "bInfo": false, "bFilter": false, "bStateSave": false, "aoColumns": [ null, { "sType": "date" }, null, { "sType": "curr

我有一个jQuery数据表,配置如下:

$('#invoiceListing').dataTable({
  "aaSorting": [[0, "desc"]],
  "bPaginate": false,
  "bInfo": false,
  "bFilter": false,
  "bStateSave": false,
  "aoColumns": [
    null, 
    { "sType": "date" },
    null, 
    { "sType": "currency" }, 
    { "sType": "date" }, 
    { "bSortable": false }
  ]
});
第三列(未定义特殊类型)包含发票的名称。人们发现,当使用文本和数字的某些组合时,排序不正确

以以下两张发票为例:

Month A - Month B - Sorts correctly
Month 1 - Month 2 - doesnt sort at all
Month 1a - Month 2a - Sorts correctly
为什么以数字结尾的值不能排序?在末尾添加一个附加字符会立即使它们重新开始排序


编辑:正在使用的DataTables版本是*版本:1.7.6

我添加了一个答案来结束这个问题

指定
sType
,因为字符串将解决此问题

"sType": "string"

我从未使用过aoColumns,但是当您设置“bSortable”时会发生什么:true而不是false?嗨,John,aoColumns是一个数组,您可以通过它为每个列设置各种属性。该b排序表与表中包含编辑/查看按钮的结束列相关,因此该列上的排序被禁用。这不会影响第三列的排序。好的。您需要使用此AO列吗?在我所有的应用程序中,我都使用了列:[{data:“number”},…],这样,我就可以对我想要的所有列进行排序,并为每一列设置各种属性。不幸的是,我使用的是v1.7.6Yes:/。您是否尝试过
“sType”:“string”
“sType”:“natural”