2013-03-24 3 views
2

이 멍청한 질문에 대해 죄송합니다.하지만 몇 시간 동안 고생없이 고생하고 있습니다. 샘플 테이블이 정렬되지 않습니다. 두 .js 파일은 모두 .shtml 파일 자체와 동일한 디렉토리에 있습니다.tablesorter not sorting

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us"> 
<head> 
<script type="text/javascript" src="jquery-latest.js"></script> 
<script type="text/javascript" src="jquery.tablesorter.js"></script> 
<script type="text/javascript"> 
$(document).ready(function()  
    {  
        $("#myTable").tablesorter();  
    }  
);  
</script> 
</head> 
<body> 
<table id="myTable" class="tablesorter"> 
    <thead> 
    <tr> 
    <th>Test1</th> 
    <th>Test2</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr> 
    <td>1</td> 
    <td>1622</td> 
    </tr> 
    <tr> 
    <td>2</td> 
    <td>2634</td> 
    </tr> 
    </tbody> 
</table> 
</body> 
</html> 

답변

4

jquery와 tablesorter의 잘못된 복사본이있을 수 있습니다. 각각의 사이트에서 링크 된 jquery와 tablesorter의 실제 버전을 사용하여 잘 작동하는 것처럼 보입니다.

http://code.jquery.com/jquery-1.9.1.js
http://mottie.github.com/tablesorter/js/jquery.tablesorter.js

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us"> 
<head> 
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> 
<script type="text/javascript" src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() 
    { 
     $("#myTable").tablesorter(); 
    } 
); 
</script> 
</head> 
<body> 
<table id="myTable" class="tablesorter"> 
    <thead> 
    <tr> 
    <th>Test1</th> 
    <th>Test2</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr> 
    <td>1</td> 
    <td>1622</td> 
    </tr> 
    <tr> 
    <td>2</td> 
    <td>2634</td> 
    </tr> 
    </tbody> 
</table> 
</body> 
+0

감사합니다. 나는 일반적인 설정 문제가 있어야 할까 봐 걱정된다. 귀하가 제공 한 소스가 작동하지 않습니다 ... –

+0

그래, 확실하지 않습니다. 이 기능은 Chrome과 IE8에서 모두 효과가 있었지만 IE8에서는 스크립트를 허용해야했습니다. – Ngenator

+3

tablesorter의 [this fork] (http://mottie.github.com/tablesorter/docs/)를 사용하십시오. 그것은 몇 년 동안 업데이트 된 적이없는 원본과 모든 종류의 문제를 해결합니다. –