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