TolMera TolMera - 1 month ago 5
Javascript Question

Dynamically Loaded table - Sort with Javascript - No errors? What's happening?

I've got a table that I'm trying to sort.
The Table is loaded by a javascript and inserted into the document by: (abreviated)

document.getElementById("").innerHTML("")


Once the table has been loaded, I want to make the table sortable. But it's not working? I'm not getting any errors on FireBug. and I've tried this with several different table sorting scripts.

I've been researching it a little, and can't find much on dynamically loaded tables. This one comes close "How to sort a dynamically rendered table...?" but I want to know more about why that one is working, and mines not.

My Sample site "http://play.tol1dc.homedns.org" So you can see what I'm doing.

Answer

You need an id on your table, not a class, as specified here:

// Note that all the tables that need to be sorted MUST contain ID tag. // So, if they do not exist, you must create one for each table that // needs to be sorted. Also, the table names/ids MUST BE UNIQUE.

Replace class by id in your severside code that generates the html table.

Comments