SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Zealot alix's Avatar
    Join Date
    Jun 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question jQuery: tablesorter is not sorting my digits column

    Hi. I can't seem to find the solution to this.

    I've got a table with a column with numeric values but it doesn't sort right, this is an example of what happens:
    100.00
    1000.00
    1000.00
    1300.00
    1700.00
    200.00

    this is my code:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
    <head>
    <title>Freelance Project</title>
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <style type="text/css">@import "js/jq.css";</style>
    <link rel="stylesheet" href="main-style.css" type="text/css" />
    <script type="text/javascript" src="js/pngfix.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.metadata.js"></script>
    <script type="text/javascript" src="js/jquery.tablesorter.js"></script>
    <link rel="stylesheet" href="js/themes/blue/style.css" type="text/css" media="print, projection, screen" />
    <script type="text/javascript" id="js">
    $(document).ready(function() { 
        $("#rank").tablesorter(); 
    });
    </script>
    <!--[if lt IE 7.]>
    <script defer type="text/javascript" src="js/pngfix.js"></script>
    <![endif]-->
    </head>
    <body>
    	<div id="pagewidth" >
    		<div id="header" >
    			<div id="register">
    				<a href="register.php"><img src="images/register.png" width="64" height="64" alt="registrarse" title="Registrarse" border="0"/></a>
    				<a href="register.php"><span>Registrarse</span></a>
    			</div>
    			<div id="login">
    				<a href="login.php"><img src="images/login.png" width="64" height="64" alt="iniciar sesi&oacute;" title="Iniciar Sesi&oacute;n" border="0"/></a>
    				<a href="login.php"><span>Iniciar Sesi&oacute;n</span></a>
    			</div>
    		</div>
    		<div id="wrapper" class="clearfix" > 
    		<div id="maincol" >
    			<div id="welcome">
    				<div style="width: 950px; margin: 0 auto 0 auto; padding-top: 25px;">
    					<span style="font-size: 14px;"><strong>&iquest;C&oacute;mo funciona?</strong></span>
    					Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin pretium, mauris eu fringilla varius, erat dui malesuada mi, quis dignissim tellus orci vel mauris. Pellentesque ut lacus a dolor facilisis mattis. Integer consectetuer risus ac purus. Ut tristique risus. Integer leo. Donec ac turpis in mauris faucibus lobortis. Curabitur fringilla, massa nec faucibus lobortis, nisi lorem interdum enim, quis dignissim risus nisi eu nibh. Nullam vitae eros. Ut quis est malesuada risus rutrum commodo. Quisque nisl neque, interdum ac, luctus nec, varius at, nisl. Integer quam lectus, tincidunt in, suscipit ut, vehicula vel, lacus. Fusce metus tellus, aliquet ac, ornare vitae, adipiscing in, nibh. Duis vel quam. Vivamus quam.
    				</div>				
    			</div>
    			<div id="projects-rank">
    				<div style="font-weight: bold; text-align: center; width: 673px;">Los 10 proyectos m&aacute;s populares</div>
    				<div id="table-rank">
    					<table cellspacing="1" class="tablesorter" width="673" id="rank">             
    					    <thead> 
    					        <tr> 
    					            <th>Proyecto</th> 
    					            <th>Fecha</th> 
    					            <th class="{sorter: 'number'}">Presupuesto</th> 
    					        </tr> 
    					    </thead> 
    					    <tbody> 
    					        <tr> 
    	 							<td width="490">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</td>
    	 							<td width="83">01/01/2008</td>
    	 							<td width="100" align="right">100.00</td>
    					        </tr>
    					        <tr> 
    	 							<td width="490">BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
    	 							<td width="83">02/01/2008</td>
    	 							<td width="100" align="right">1000.00</td>
    					        </tr>
    					        <tr> 
    	 							<td width="490">CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</td>
    	 							<td width="83">22/11/2007</td>
    	 							<td width="100" align="right">1000.00</td>
    					        </tr>
    					        <tr> 
    	 							<td width="490">DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</td>
    	 							<td width="83">03/01/2008</td>
    	 							<td width="100" align="right">1300.00</td>
    					        </tr>
    					        <tr> 
    	 							<td width="490">EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE</td>
    	 							<td width="83">04/01/2008</td>
    	 							<td width="100" align="right">200.00</td>
    					        </tr>				        
    					        <tr> 
    	 							<td width="490">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</td>
    	 							<td width="83">05/01/2008</td>
    	 							<td width="100" align="right">2300.00</td>
    					        </tr>				        
    					        <tr> 
    	 							<td width="490">GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG</td>
    	 							<td width="83">06/01/2008</td>
    	 							<td width="100" align="right">1700.00</td>
    					        </tr>				        
    	
    					        <tr> 
    	 							<td width="490">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</td>
    	 							<td width="83">02/01/2008</td>
    	 							<td width="100" align="right">3300.00</td>
    					        </tr>				        
    					        <tr> 
    	 							<td width="490">IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII</td>
    	 							<td width="83">16/01/2008</td>
    	 							<td width="100" align="right">2100.00</td>
    					        </tr>				        
    					        <tr> 
    	 							<td width="490">JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ</td>
    	 							<td width="83">09/01/2008</td>
    	 							<td width="100" align="right">3700.00</td>
    					        </tr>				 			        
    					</table>
    				</div>	
    			</div>			
    			<div id = "buttons">
    				<a href="/projects/start.php"><img src="images/start-project.png" width="300" height="145" alt="Inicia un proyecto!" title="Inicia un proyecto!" border="0"/></a>
    				<a href="/projects/search.php"><img src="images/find-project.png" width="300" height="145" alt="Encuentra un proyecto!" title="Encuentra un proyecto!" border="0"/></a>
    			</div>		
    		</div>
    	</div>
    	<div id="footer" >&copy;Copyright 2008 - Freelance Project - Todos los derechos reservados</div>
    	</div>
    </body>
    </html>
    Can somebody help me?
    Last edited by alix; May 16, 2008 at 22:23. Reason: correction in code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •