2015-10-22 35 views
0

https://datatables.net/examples/api/row_details.html數據表 - 嵌套表高度風格

我創建嵌套表爲按照上述數據表例如額外的信息來源。我創建了兩個類似於示例中的表格。我現在試圖將這些表格的高度設置爲固定值並啓用滾動,以便在存在大量信息的情況下滾動小表格。

我已將此添加到dataTables.css:

table.dataTable table 
{ 
    //all of these work 
    width: 47%; 
    margin:1%; 
    float:left; 
    border: solid 1px #dddddd; 

    // none of these take affect 
    min-height: 50px !important; 
    max-height: 50px !important; 
    height: 50px !important; 
    overflow-y: scroll; 
} 

瀏覽器檢查正確顯示所有的CSS在桌子上,會忽略高度/滾動一些未知的原因,我unusre爲什麼一半的樣式在工作中。

  • 我還可以如何設置嵌套表的高度?

回答

0

SOLUTION

可以在format()包裹你的孩子排在<div class="child-container></div> JavaScript函數和應用下面的CSS規則:

table.dataTable .child-container { 
    max-height: 150px; 
    overflow-y: auto; 
} 

table.dataTable .child-container table { 
    width: 47%; 
    margin:10px 10px 10px 40px; 
    float:left; 
    border:1px solid #DDD; 
} 

DEMO

查看this jsFiddle的代碼和演示。

+0

謝謝..這種有點像我需要的工作,試圖讓嵌套表''成爲固定的高度壽。我不確定爲什麼我不能在桌子上設置高度? – Orbitall