相关疑难解决方法(0)

如何向表头添加工具提示

我正在使用jQuery DataTables,并且我一直试图在过去2天内将工具提示添加到我的数据表的Header列中无济于事.

我在datatables网站上使用了示例,其中工具提示已添加到行数据中,但这不起作用.我只看到一个工具提示,它甚至没有得到列的标题.

下面是我到目前为止的代码.

if (oTable != null) {
    oTable.fnClearTable();
    oTable.fnAddData(columnData);
} else {

    oTable = $('#caseDataTable').dataTable({
        "bDestroy": true,
        "aaData": columnData,
        "aoColumnDefs": columnNames,
        bFilter: true,
        bAutoWidth: true,
        autoWidth: true,
        "responsive": true,
        dom: 'Bfltip',
        buttons: [
            {
                extend: 'colvis',
                postfixButtons: ['colvisRestore'],
                collectionLayout: 'fixed two-column'
            }
        ],
        "fnDrawCallback": function() {
            if (typeof oTable != 'undefined') {
                $('.toggleCheckBox').bootstrapToggle({});
            }

            $('#caseDataTable thead tr').each(function () {
                var sTitle;
                var nTds = $('td', this);
                var columnTitle= $(nTds[0]).text();

                 this.setAttribute('title', columnTitle);
            });

            /* Apply the tooltips */
            $('#caseDataTable …
Run Code Online (Sandbox Code Playgroud)

javascript jquery tooltip datatables

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

datatables ×1

javascript ×1

jquery ×1

tooltip ×1