SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Javascript Table Sorting

    I am trying to implement javascript sorting on following table structure, I found various online scripts but those works only on click and not on my table structure. I am trying to sort the table on First Name field without clicking on it i.e. sorting is needs to be done on onload function by First Name . Can any one help me to sort this table structure :


    HTML Code:
    <table id="result_table" class="sortable" border="1" cellpadding="0" cellspacing="0" rules="none">
    
    	
    	<thead>
    		<tr>
    		
    		<td bgcolor="#999999" colspan="2" class="rec">Heading 1 <br />
    		
    			<span class="pName">Heading 2</span></td>
    			<td bgcolor="blue" colspan="2" align="right" class="whtBorder">
    				<input type="image"  />			</td>
    		</tr>
    		<tr>
    			<td>select</td>
    			<th abbr="link_column">First Name </td>
    			<td>ID </td>
    			<td>Date</td>
    		</tr> 	
    		<tr>   
    		  <td colspan="4">   
    			<strong>Category 1</strong>		  </td>            
    		</tr>  			
    	</thead>
        <tbody>
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="51779700"/>        </td>
    
            <td class="box2">  
                <a href="go.html">zzz</a>        </td>   
            <td class="box3">    
                1121       </td> 
            <td class="box4"> <span class="date"> 12/10/07										 </span>        </td>                
          </tr>  
             
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="57117900"/>        </td>
            <td class="box2">  
                <a href="go.html">Twin</a>        </td>   
            <td class="box3">3432432</td> 
            <td class="box4"><span class="date"> 12/10/07 </span> </td>
          </tr>  
             
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="51777600"/>        </td>
            <td class="box2">  
                <a href="go.html">my tt </a>        </td>   
            <td class="box3">    
                55       </td> 
            <td class="box4"><span class="date"> 12/10/07 </span> </td>
          </tr>  
             
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="51777900"/>        </td>
            <td class="box2">  
                <a href="go.html">sort this </a>        </td>   
            <td class="box3">    
                676       </td> 
            <td class="box4"><span class="date"> 12/10/07 </span> </td>
          </tr>  
                </tbody>   
         
          <tr>   
              <th colspan="4">   
                <strong>Category 2 </strong>          </th>            
          </tr>     
     
             
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="51829100"/>        </td>
            <td class="box2">  
                <a href="go.html">using java script </a>        </td>   
            <td class="box3">    
                67868       </td> 
            <td class="box4"><span class="date"> 12/10/07 </span> </td>
          </tr>  
             
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="51829400"/>        </td>
            <td class="box2">  
                <a href="go.html">M</a>        </td>   
            <td class="box3">    
                44       </td> 
            <td class="box4"><span class="date"> 12/10/07 </span> </td>
          </tr>  
             
          <tr> 
            <td class="box1"><input type="checkbox" name="ID" value="51829200"/>        </td>
            <td class="box2">  
                <a href="go.html">L</a>        </td>   
            <td class="box3">    
                TTgg77       </td> 
            <td class="box4"><span class="date"> 12/10/07 </span> </td>
          </tr>
    	</table>
    Last edited by simplecode; Oct 8, 2007 at 04:58.


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
  •