0
我想使用JQuery Datatables唯一地鏈接表的每一行。我遇到的問題是我可以如何存儲,或者查看每個數據表的每一行的唯一鏈接。表體動態地從數據庫中創建爲這樣連接數據表中的一行
echo "
<table id='table_id' class='table table-striped'>
<thead>
. . .
</thead>
<tbody>
";
while($row) {
// The uniquely value to represent the link to each row is
// <a href ='rideinfo?PostID=$row[6]'></a>
echo "
<tr>
<td>$row[1]</td>
<td>$departDate</td>
<td>$departTime</td>
<td>$row[2]</td>
<td>$returnDate</td>
<td>$returnTime</td>
<td>$$row[5]</td>
</tr>
";
$row = $result->fetch_row();
}
jQuery的是
$(document).ready(function() {
var oTable = $('#table_id').dataTable({
"sPaginationType": "bootstrap"
});
$("#table_id tbody tr").live('click',function() {
// I am not sure here how to store and get the id for each row
document.location.href = "?PostID=" + id;
});
});
如何讓每一行相應該值將非常感激任何幫助。
是它爲你工作..? – Gautam3164 2013-05-09 05:46:40
這有效,但我得到的問題是分頁,出於某種原因鏈接只在第一頁上工作 – user1875195 2013-05-09 05:47:05
給我分頁腳本.. ?? – Gautam3164 2013-05-09 05:48:03