【问题标题】:The last column header text is aligned vertically top using datatable最后一列标题文本使用数据表垂直顶部对齐
【发布时间】:2012-10-05 07:31:35
【问题描述】:

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

提前致谢!

【问题讨论】:

    标签: jquery css json datatable


    【解决方案1】:

    检查这个Fiddle

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

    css

    .top {
        vertical-align: top;
     }
    

    【讨论】:

      猜你喜欢
      • 2015-10-18
      • 1970-01-01
      • 2014-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多