Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Using a jquery tablesorter


longhorn1999

Recommended Posts

Posted

http://tablesorter.com/docs/#Download

 

I made a page with a HTML table that shows the products in my store for comparison's sake. I was hoping that this jquery tablesorter would be a simple install as it seems pretty nifty and I'm not sure what contribution if any contribution is similar to it, but I'm messing up one step.

 

After you include the script in the head of the page, it says to:

 

Start by telling tablesorter to sort your table when the document is loaded:

$(document).ready(function() 
   { 
       $("#myTable").tablesorter(); 
   } 
); 

 

Does anyone know what document this code goes in and what the proper syntax might be? I clumsily tried copying it into my-comparison-chart.php and includes/functions/html_output.php and only keep getting error messages.

 

Thanks for any suggestions.

Posted

In the examples they have, it goes at the end of the <head> section of the page (after all the other javascript includes) and should look like this:

 

<script type="text/javascript" id="js">$(document).ready(function() 
   {
        $("#myTable").tablesorter();
   }
); 
</script>

 

Keep in mind it's java script - not php

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

You also need to give the table you want to sort the corresponding ID;

 

<table id="#myTable" .......

Posted

Awesome...thanks guys, that worked perfectly. I guess I should've thought to just click on 'View Source' for the example pages.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...