SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid 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 03:58.

  2. #2
    SitePoint Zealot rhlowe's Avatar
    Join Date
    Sep 2006
    Location
    San Diego
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jQuery may be able to help you out, http://docs.jquery.com/Plugins/Tablesorter
    San Diego Freelance Web Development Contractor
    Great Taste, no Filler. Now with no Trans Fat!

  3. #3
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am looking into it. sound good to me. Thanks . i will get back to u.

  4. #4
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dude 
    I am impressed

  5. #5
    SitePoint Zealot rhlowe's Avatar
    Join Date
    Sep 2006
    Location
    San Diego
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem i think, I didn't write the plugin, I just use jQuery alot because it does some really advanced stuff easily. Makes my JavaScripting go much quicker!
    San Diego Freelance Web Development Contractor
    Great Taste, no Filler. Now with no Trans Fat!


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
  •