【问题标题】:How to center image in column Datables BootStrap如何在 Datatables BootStrap 列中居中图像
【发布时间】:2016-03-11 18:20:11
【问题描述】:

使用 Datables BootStrap,在我这样做的列中集中 img

$('#despatchEntryDetails').dataTable({
        "responsive": true,
        "autoWidth": false,
        "columns": [
            { "title": "Numéro" },
            { "title": "Date création" },
            { "title": "Sujet" },
            { "title": "Etat" },
            { "title": " ",  
              "width": "32px", 
              "orderable": false, 
              "data": null,
              "className": "dt-body-center",
              "defaultContent": '<input name="submit" id="viewDetail" type="image" src="btn_vuedetail.gif" onclick="viewDetail();" />',
            }       
        ],
        data: dataSet
    });
  });

预计这会在最后一列中居中图像,但它似乎不起作用。

参考:DataTables Cell classes options

有什么想法吗?

【问题讨论】:

标签: jquery html css twitter-bootstrap datatables


【解决方案1】:

@Gyrocode.com 感谢您的帮助。

我找到了为什么它在我的网站上不起作用。我忘了添加样式表:jquery.dataTables.css

有了这个样式表就OK了

<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<link rel="stylesheet" href="plugins/datatables/jquery.dataTables.min.css"> 

【讨论】:

    猜你喜欢
    • 2018-03-05
    • 2017-08-02
    • 2013-10-13
    • 2018-12-08
    • 2015-11-07
    • 2013-12-14
    • 2014-04-09
    • 1970-01-01
    相关资源
    最近更新 更多