繁体   English   中英

最后一列标题文本使用datatable在垂直上方对齐

[英]The last column header text is aligned vertically top using datatable

我有一个从json文件中填充的数据表。 我的问题是最后一列的标题文本在垂直上方对齐(标题栏的高度也变成了两倍)。

有没有人对此有解决方案。

这是我的数据表代码。

$(document).ready(function() {
    var oTable = $('#genericTable').dataTable( {
        "bProcessing": true,
        "sAjaxSource": "../jsonData/resources/json/" + key + ".json",
        "sPaginationType"   : "full_numbers",
        "bJQueryUI"         : true,
        "bRetrieve"         : true,
        "bPaginate"         : true,
        "bSort"             : true,
        "aaSorting"  : [[ 3, "desc" ]],
        "iDisplayLength"    : 50,
        "bAutoWidth"        : false,
        "aoColumns": [
                      { "sTitle": "Name" },
                      { "sTitle": "Description" },
                      { "sTitle": "Date" },
                      { "sTitle": "Action" }
                    ],
        "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
            if(typeof aData[0] != 'string'){
                $('td:eq(0)', nRow).html( '<a href="' + aData[0]['link'] +'" style="color:blue">'  +
                        aData[0]['displayValue'] + '</a>');
            }
            $('td:eq(3)', nRow).html( '<a href="' + aData[3]['link'] +'" style="color:blue">'  +
                    aData[3]['displayValue'] + '</a>');
        }
    }).columnFilter({ sPlaceHolder: "head:after",
        aoColumns: [ { type: "text" },
                     { type: "text" },
                     null
                   ]
    });
});

提前致谢!

检查这个小提琴

"aoColumns": [ 
     { type: "text" },
     { type: "text" },
     { type: "text" },
     { "sClass": "top" }
]

的CSS

.top {
    vertical-align: top;
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM