2016-08-04 34 views
4

正在使用的數據表,並且還加入ScrollY進去...... DataTable的渲染,所以當我有很多列,我的屏幕不能滿足所有的這,它只會增加垂直滾動的數據表形成....而問題是adminlte有一個功能,可以隱藏和顯示側邊欄,它會改變整個區域的數據表,並在結果就會使錯了,就像這樣:與ScrollY(表身體得到調整,但THEAD是沒有得到調整)

我的表的身體得到調整,但THEAD是沒有得到調整

這是一個測試鏈接到我的臨時頁 https://htmlpreview.github.io/?https://github.com/farazGreen/DataTable/blob/master/GreenBow_%20TEST.html

同樣的問題已經在ADMINLTE網站被要求由另一人 https://github.com/almasaeed2010/AdminLTE/issues/1136

+0

我創建一個GIT [GIT鏈接](https://github.com/farazGreen/DataTable) –

回答

0

嘗試autoWidth添加到false

$('#example').dataTable({ 
    "autoWidth": false 
}); 

或者你可以resize()表上窗口調整大小事件

$(window).resize(function() { 
      $("#example").resize(); 
}); 

Edit

在我的本地pc這段代碼唯一的工作添加"autoWidth": false並取出scrollY"scrollY":""

$('#tblOpWaiting').DataTable({ 
    "bFilter" : false, 
    "ordering" : false, 
    "scrollY" : "", 
    "scrollCollapse" : true, 
    responsive : true, 
    "paging" : false, 
    autoWidth:false 
}); 
$('#tblOpConsulted').DataTable({ 
    "bFilter" : false, 
    "ordering" : false, 
    "scrollY" : "", 
    "scrollCollapse" : true, 
    responsive : true, 
    "paging" : false, 
    autoWidth:false 
}); 
+0

請不要檢查此鏈接, 窗口是沒有得到調整大小,它是一個div被調整大小 ,我試過autoWidth:false 也autoWidth:true [檢查此鏈接](https://htmlpreview.github.io/?https://github.com/ farazGreen/DataTable/blob/master/GreenBow_%20TEST.html) –

+0

@MunasirPv check edit ans –

+0

「paging」:false你有fo 「 如果你檢查你的控制檯窗口,你可以看到錯誤 未捕獲的SyntaxError:意外的標識符 所以datatable屬性沒有設置。 試着把逗號,看看它是否工作..它沒有爲我工作 –