0

我有一个从 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
                   ]
    });
});

提前致谢!

4

1 回答 1

0

检查这个小提琴

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

css

.top {
    vertical-align: top;
 }
于 2012-10-05T07:59:33.533 回答