(看了一堆关于这个话题的答案,没有一个适用于这个问题。)
DataTables 具有让用户单击每列的向上/向下三角形图标以按升序或降序排序的功能。我已按如下方式加载数据
oTable.fnAddData( ["Bogus data","1,541,512","12.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","3,541,512","2.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","541,512","1.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","2,541,512","32.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","741,512","3.5%","0","0","0"]);
oTable.fnAddData( ["A Bogus data","41,512","1.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","2,541,512","12.5%","0","0","0"]);
oTable.fnAddData( ["Z Bogus data","1,541,512","12.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","3,541,512","2.5%","0","0","0"]);
oTable.fnAddData( ["La Bogus data","541,512","1.5%","0","0","0"]);
oTable.fnAddData( ["The Bogus data","2,541,512","32.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","741,512","3.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","41,512","1.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","2,541,512","12.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","1,541,512","12.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","3,541,512","2.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","541,512","1.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","2,541,512","32.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","741,512","3.5%","0","0","0"]);
oTable.fnAddData( ["Bogus data","41,512","1.5%","0","0","0"]);
在第 2 列中,当我单击向上/向下三角形时,数值按字母顺序处理。如何调整它以便第二列向上/向下箭头将触发正确的方式,将字符视为数字。我尝试使用以下初始化:
oTable = $('.utable').dataTable( {
"aoColumns": [{ sWidth: '60%' },{sWidth: '30%', "sType": "numeric"},{ sWidth: '10%' }],
"sDom": 'rt',
"sScrollY":"200px",
"bPaginate":false,
"bFilter":false,
"bInfo": false});
所有这一切都是为了锁定列,并且向上/向下图标在该列的标题中不起作用。