我在Rails站点上使用数据表,并打算利用它的行重新排序插件。datatables网站上的文档说实现很容易-我要做的就是;
$(document).ready(function(){
$('#example').dataTable()
.rowReordering();
});
但是对于我的一生,我无法弄清楚如何使用CoffeeScript完成此操作,或者甚至是否有必要。我当前的ds.js.coffee文件如下所示:
jQuery ->
$('#thetable').dataTable
bDestroy: true,
sPaginationType: "full_numbers",
bAutoWidth: false,
aLengthMenu: [[25,50,100,-1],[25,50,100,"All"]],
iDisplayLength: 50,
aoColumns: [{ "bSortable": false }, null,null,null,null,null,null,null,null],
aaSorting: [[ 1, 'asc' ]],
bStateSave: true;
$(document).ready ->
$('#thetable').dataTable
.rowReordering();
但是,在管理好此内容之后,就不会再进行任何拖放操作了。
这不是函数调用:
$('#thetable').dataTable # <----------------
.rowReordering();
当您在不带参数的情况下(以及其他各种地方)调用函数时,函数调用括号不是可选的,您需要说:
$('#thetable').dataTable().rowReordering()
或者
$('#thetable').dataTable()
.rowReordering();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句