Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:04:01+00:00 2026-05-26T23:04:01+00:00

I wrote a JS code that generates a table and plugs it into a

  • 0

I wrote a JS code that generates a table and plugs it into a div on my page. I would like to use the sort table plugin from here.
here is the code I have until now:

  TableHtml = ''
  TableHtml += '<div id="table_wrapper" class="scrollable"><table style="width:900px" id="mytable" class="sortable tabular">'
  TableHtml += '<thead><tr>'
  TableHtml += '<th class="labels"><span class="nowrap">Date</span></th>'
  TableHtml += '<th class="labels"><span class="nowrap">Client</span></th>'
  TableHtml += '<th class="labels"><span class="nowrap">Pass</span></th>'
  TableHtml += '<th class="labels"><span class="nowrap">Objet</span></th>'
  TableHtml += '<th class="labels"><span class="nowrap">Panne</span></th>'
  TableHtml += '<th class="labels"><span class="nowrap">Cause</span></th>'
  TableHtml += '<th><div id="headerbg"><span class="nowrap">Action</span></div></th>'
  TableHtml += '<TH class="sorttable_nosort scrollbarCol"></TH>'
  TableHtml += '</tr></thead><tbody>'

  var trclass = '';
  var d=0               
  if(!rsDetail.bof) {
    rsDetail.MoveFirst()
    while(!rsDetail.eof) {
      detAvis  = rsDetail.fields(0).value;
      detDate = rsDetail.fields(2).value;
      detClient = rsDetail.fields(4).value
      detPass = rsDetail.fields(5).value
      detObjet = rsDetail.fields(9).value
      detPanne = rsDetail.fields(10).value
      detCause = rsDetail.fields(11).value
      detAction = rsDetail.fields(12).value

        //filling up he rows
      if (d%2){
      trclass='d1'
      }
      else{
      trclass='d2'
      }
      TableHtml += '<tr id="' + detAvis + '" class="' + trclass + '" onclick="Select(' + detAvis + '); showDetails(' + detAvis + ');">'
      TableHtml += '<td class="td1">' + detDate + '</td>'
      TableHtml += '<td class="td2">' + detClient + '</td>'
      TableHtml += '<td class="td3">' + detPass + '</td>'
      TableHtml += '<td class="td4">' + detObjet + '</td>'
      TableHtml += '<td class="td5">' + detPanne + '</td>'
      TableHtml += '<td class="td6">' + detCause + '</td>'
      TableHtml += '<td class="td7">' + detAction + '</td>'
      TableHtml += '</tr>'        
      d++
      rsDetail.MoveNext()
    }
  }   
  TableHtml += '</tbody></table></div>'

  rsDetail.close()
  document.getElementById('DetailTable').innerHTML = TableHtml;

and my reference in the head:

<script type="text/javascript" src="js/sorttable.js"></script>

the reference is from here.

The table is scrollabale but somehow stays unsortable. Any idea what the problem might be?
I have tried attributing the sortable class to another table that is not JS generated on the same page and it works…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:04:01+00:00Added an answer on May 26, 2026 at 11:04 pm

    you need to call the makeSortable:

    sorttable.makeSortable(document.getElementById('mytable'));
    

    see the comment here form scott W (search for makeSortable):
    http://www.kryogenix.org/days/2007/04/07/sorttable-v2-making-your-tables-even-more-sortable

    and here also mentions makeSortable:
    http://www.kryogenix.org/bugs/sorttable/ajax-tables.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote code that simply generates a table gridview. The last column provides a
I'm trying to write some LINQ To SQL code that would generate SQL like
I want to write reusable code that takes an HTML table from a JSP
I wrote some code to generate a boost::mpl::vector to use as a lookup table
Often, programmers write code that generates other code. (The technical term is metaprogramming ,
Sometimes while writing Java in Eclipse, I write code that generates warnings. A common
I'm trying to write a unit test for a piece of code that generates
Are there any Code Generators that would take a well-formed XML document, and write
So I wrote buggy code that occasionally crash ... and creates a stackdump file.
I recently wrote some javascript code that filled a drop down list based on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.