我正在处理分页问题,使用了DataTables插件,在某些表格上它能正常工作,但在某些表格上会出现以下错误:
Uncaught TypeError: Cannot read property 'aDataSort' of undefined
我的页面脚本如下:
Uncaught TypeError: Cannot read property 'aDataSort' of undefined
我的页面脚本如下:
$(document).ready(function() {
$('.datatable').dataTable( {
"scrollY": "200px",
"scrollCollapse": true,
"info": true,
"paging": true
} );
} );
//HTML代码
<table class="table table-striped table-bordered datatable">
<thead>
<tr>
<th><?php echo lang('date_label')?></th>
<th><?php echo lang('paid_label')?></th>
<th><?php echo lang('comments_label');?></th>
</tr>
</thead>
<tbody>
<?php foreach ($payments as $pay): ?>
<tr>
<td><?php echo dateformat($pay['time_stamp'], TRUE);?></td>
<td><?php echo format_price($pay['amount']);?></td>
<td><?php echo $pay['note'];?></td>
</tr>
<?php endforeach?>
</tbody>
</table>
我不知道问题是怎么出现的,虽然这是一个非常普遍的错误,但我搜索了许多内容,没有找到任何支持我的问题的信息。
有人知道解决方案吗?
datatables
的排序功能,能否发布整个相关代码? - Nikos M.