alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow jQuery arrow jQuery - JavaScript Sorting
Site Search


jQuery - JavaScript Sorting
Article Index
jQuery - JavaScript Sorting
Row Grouping Tags

Learning jQuery - JavaScript Sorting

There are times, though, when we either don't want to wait for server responses when sorting, or don't have a server-side scripting language available to us. A viable alternative in this case is to perform the sorting entirely on the browser using JavaScript client-side scripting.

For example, suppose we have a table listing books, along with their authors, release dates, and prices:

  1. <table style="WIDTH: 539px; HEIGHT: 253px" class="sortable">
  2. <thead>
  3. <tr>
  4. <th> </th>
  5. <th>Title</th>
  6. <th>Author(s)</th>
  7. <th>Publish Date</th>
  8. <th>Price</th>
  9. </tr>
  10. </thead>
  11. <tbody>
  12. <tr>
  13. <td>
  14. </td>
  15. <td>Building Websites with Joomla! 1.5 Beta 1</td>
  16. <td>Hagen Graf</td>
  17. <td>Feb 2007</td>
  18. <td>$40.49</td>
  19. </tr>
  20. <tr>
  21. <td> </td>
  22. <td>Learning Mambo: A Step-by-Step Tutorial to Building Your
  23. Website</td>
  24. <td>Douglas Paterson</td>
  25. <td>Dec 2006</td>
  26. <td>$40.49</td>
  27. </tr>
  28. </tbody>
  29. </table>
  30.  
 

We'd like to turn the table headers into buttons that sort by their respective columns. Let us look into ways of doing this.



 
< Prev   Next >
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape