zoukankan      html  css  js  c++  java
  • datatables 添加title属性

    datatables 添加title属性

    使用 createdRowcolumns.createdCell options 来定义一个回调函数用于创建 TR and TD 元素时添加属性.

    $('#example').dataTable( {
      'createdRow': function( row, data, dataIndex ) {
          $(row).attr('id', 'someID');
      },
      'columnDefs': [
          {
          'targets': 3,
          'createdCell':  function (td, cellData, rowData, row, col) {
            $(td).attr('id', 'otherID');
          }
        }
      ]
    });
    

    Example:给td元素添加title属性

    columns: [{
        "sClass": "member",
        "data": "id",
        "render": function (data, type, full, meta) {
          return '<i class="check_icon check_false" data-value="' + data + '">';
        },
        "bSortable": false
      },
      {
        "data": "name",
        'createdCell':  function (td, cellData, rowData, row, col) {
          $(td).attr('title', cellData); 
        }
      },
      {
        "data": "email",
        'createdCell':  function (td, cellData, rowData, row, col) {
          $(td).attr('title', cellData); 
        }
      }
    }]
    
  • 相关阅读:
    fort循环
    while
    函数和数组
    case
    init进程
    权限安全:堡垒机部署实践
    tcp首部当中seq和ack的增长规律
    VRRP
    MSTP
    字符集专题
  • 原文地址:https://www.cnblogs.com/dragonir/p/12200345.html
Copyright © 2011-2022 走看看