2016-12-06 36 views
0

我想改變我的表的一些設置與數據表功能,不過參數jQuery的數據表功能選項不工作

paging: false, 
scrollY: 400 

都沒有任何上表的任何影響。


<html> 
<head> 
    <meta charset=utf-8 /> 
    <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"> 
</head> 
<body> 


<table id='example'> 
    <thead> 
    <tr><th class='site_name'>Name</th><th>Url </th><th>Type</th><th>Last modified</th></tr> 
    </thead> 
    <tbody> 
    </tbody> 
</table> 


    <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> 
    <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script> 

    <script> 

$("#example").DataTable({ 
    "aaData":[ 
    ["Sitepoint","http://sitepoint.com","Blog","2013-10-15 10:30:00"], 
    ["Flippa","http://flippa.com","Marketplace","null"], 
    ["99designs","http://99designs.com","Marketplace","null"], 
    ["Learnable","http://learnable.com","Online courses","null"], 
    ["Rubysource","http://rubysource.com","Blog","2013-01-10 12:00:00"] 
    ], 
    paging: false, 
    scrollY: 400 
} 
); 

    </script> 
</body> 
</html> 

我從https://www.sitepoint.com/working-jquery-datatables/代碼,並從https://datatables.net/manual/options選項的說明。

回答

2

正如你可以在documentation看到:

分頁:啓用或禁用表分頁。因爲:數據表1.10

這意味着你必須改變的庫版本:

$("#example").DataTable({ 
 
    "aaData":[ 
 
    ["Sitepoint","http://sitepoint.com","Blog","2013-10-15 10:30:00"], 
 
    ["Flippa","http://flippa.com","Marketplace","null"], 
 
    ["99designs","http://99designs.com","Marketplace","null"], 
 
    ["Learnable","http://learnable.com","Online courses","null"], 
 
    ["Learnable","http://learnable.com","Online courses","null"], 
 
    ["Learnable","http://learnable.com","Online courses","null"], 
 
    ["Rubysource","http://rubysource.com","Blog","2013-01-10 12:00:00"] 
 
    ], 
 
    paging: false, 
 
    scrollY: 400 
 
} 
 
         );
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"> 
 
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> 
 
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> 
 

 

 
<table id='example'> 
 
    <thead> 
 
    <tr><th class='site_name'>Name</th><th>Url </th><th>Type</th><th>Last modified</th></tr> 
 
    </thead> 
 
    <tbody> 
 
    </tbody> 
 
</table>

1

這是你怎麼做才能在數據表版本< 1.10

"bPaginate": false, 
"sScrollY": "400px",