Jquery插件Datatables给指定列(某一列td)增加css类class方法

columns.className

Since: DataTables 1.10

Class to assign(分配) to each cell in the column.

Description

Quite simply this option adds a class to each cell in a column, regardless(不管) of if the table source is from DOM, Javascript or Ajax. This can be useful for styling columns.

Type

This option can be given in the following type(s):

Examples

Using className to assign a class to the cells in the first column with columnDefs:

$('#example').dataTable( {
  "columnDefs": [
    { className: "my_class", "targets": [ 0 ] }
  ]
} );

Using className to assign a class to the cells in the first column with columns:

$('#example').dataTable( {
  "columns": [
    { className: "my_class" },
    null,
    null,
    null,
    null
  ]
} );

原文API地址:[mdc_adfly url="http://datatables.net/reference/option/columns.className" target="_blank" label_type="text" label="点击进入(右上角跳过广告)" domain="q.gs" ad_type="banner"]

抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址