将复选框添加到 jquery 数据表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12596533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 11:51:09 来源:igfitidea点击:
Adding checkboxes to jquery datatable
提问by Lalit
I am new to JQuery. Can anyone tell me how to add checkboxes to a jquery dataTable?
我是 JQuery 的新手。谁能告诉我如何将复选框添加到 jquery 数据表?
回答by Vishal
I guess you're using the jQuery datatablesplugin here:
我猜你使用jQuery的DataTable这里插件:
You can use the aoColumnDefs
parameter to customize a column, like-
您可以使用该aoColumnDefs
参数来自定义列,例如-
aoColumnDefs : [
{
aTargets: [0], // Column number which needs to be modified
fnRender: function (o, v) { // o, v contains the object and value for the column
return '<input type="checkbox" id="someCheckbox" name="someCheckbox" />';
},
sClass: 'tableCell' // Optional - class to be applied to this table cell
}]