2012-10-22 31 views
0

下面是我使用JQuery數據表的問題摘要。數據表不顯示分頁

a。我的JSP頁面包含以下內容:

<script type="text/javascript" src="../include/jquery.dataTables.js"></script> 
<script> 
$(document).ready(function() { 
$('#snapTable').dataTable({ 
    "iDisplayLength": 5, 
    "bPaginate": true 
    }); 
}) 

    : 

function checkSnapStatus() { 
var url = "....";        // some JSP servlet return HTML table id = 'snapTable'. HTML has a div called progress_bar 
$.get(url, function(xml) { 
      $('#statuscontent').html(xml);  // Put the return HTML into div id='statuscontent' on the body element 
      var object = $('div.progress_bar'); // Get the div id=progress_bar elements = 
      $.each(object, function() { 
          //process some stuff 
          }); 

    }); 

    } 

b。 checkSnapStatus函數從body.onload調用。 $ .get函數後,顯示記錄(大量),但沒有分頁。我沒有看到上一個或下一個按鈕。

+0

嘗試var url =「....」; –

+0

Sori ..我在var url後面有一個分號。 – yapkm01

回答

1

你使用什麼版本的數據表和jQuery?我使用jQuery 1.6.4和數據表1.9.0及以下作品 -

$('#snapTable').dataTable({ 
    "bJQueryUI"  : true, 
    "iDisplayLength" : 5, 
    "sDom"   : 'T<"clear">lfrtip' 
}); 
+0

謝謝。它現在有效。 – yapkm01