안녕하세요. 저는이 문제에 전적으로 매달려 있습니다. mysql 데이터베이스에서 가져온 데이터에서 tablesorter를 사용하고 있습니다. 문제는 기준에 따라 여러 테이블을 끌어서 표시 할 수 있습니다.tablesorter 하나의 부분에 여러 개의 동적 테이블이 있습니다.
제 문제는 tablesorter가 첫 번째 테이블 인스턴스 만 정렬한다는 것입니다.
이것은 tablesorter에 사용하는 코드입니다. 그것의 기본 사용.
<script type="text/javascript" >
$(document).ready(function()
{
$("#table-2").tablesorter();
}
그리고 이것은 데이터를 가져 와서 tablesorter와 함께 사용하는 방법입니다. 변경할 수있는 것은 Branchname입니다. 사용자에게 둘 이상의 분기가 지정되면 여러 테이블이 생성됩니다. 여기에서 첫 번째 인스턴스를 지나서 어떤 테이블에서든지 tablesorter를 구현할 수 있습니다.
$result=mysql_query("SELECT id FROM users WHERE username='$username'");
$idary=mysql_fetch_assoc($result);
$id=$idary['id'];
$result0=mysql_query("SELECT branch_id FROM access WHERE userid='$id'");
while ($row1=mysql_fetch_assoc($result0))
{
$branch_id=$row1['branch_id'];
$result=mysql_query("select distinct(name) from location where id='$branch_id'");
$nameary=mysql_fetch_assoc($result);
$branchname=$nameary['name'];
?>
<table>
<thead>
<b><br><?echo $branchname; ?></b>
</thead>
</table>
<div>
<table id='table-2' class='tablesorter'>
<thead>
<tr>
<thCreator</th>
<th><center>TeamName</th>
<th><center>Tech Tot</th>
<th><center>Tot W/O</th>
<th><center>Tot S/C</th>
</tr>
</thead>
// get team creators from province
$result1=mysql_query("select distinct(teamcreator) from techteams where....
내가 뽑아 테이블의 수와 일치하는 TABLENAME를 증가의 일부 양식을 사용해야합니다 생각 해요 그러나 나는이 작업을 수행하는 방법에 갇혔어요. 나는 그 가정에 잘못 될 수 있으며 이것을하는 훨씬 쉬운 방법이있을 수 있습니다.
누구나 올바른 방향으로 어떤 조언자가 있다면 몇 가지 팁을 좋아할 것입니다.
건배, - 콜린.
+1 위의 마크 업에는 테이블 만있을 수 있기 때문에 나는'$ ("table")'을 사용하지 않겠지 만, 아마도 그 테이블은 아마도 정렬이 가능하지 않을 것입니다. – Mottie
완벽하게 작동했습니다. 감사 :) –