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

  • SEARCH
  • Home
  • 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 8571953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:53:48+00:00 2026-06-11T18:53:48+00:00

I have a table that has some 50 rows. The last cell of each

  • 0

I have a table that has some 50 rows. The last cell of each row is an image, clicking on which I show textboxes in each cell on that particular row, so user can edit the values. For this, I have written a Javascript on click of the image, I will go over that particular row and change the innerHTML of each td to have a textbox.

function insertEdittableRow(ids){  
     var row = $(ids).closest("tr");

     var tdvar = row.find('td[class=mainServer]')[0];

      var servname = tdvar.innerHTML.trim();

      tdvar.innerHTML = "'<'INPUT id=updServerName class=TextBoxStyle value='" + servname 
                +"' type=text name=updServerName/> ";

    }

This works fine. Second step I wanted to do was sorting.

On click of the table’s header, I am sorting the table. And the sort javascript goes like this. It takes up all rows, put that in an array with the old index (the rownumber) and do a sort. Then it loops over the array and create a new sorted tbody. The old unsorted tbody of the table will replaced with this new sorted one.

    for(var i=0, len=arrayOfRows.length; i'<'len; i++) {
       newTableBody.appendChild(rows[arrayOfRows[i].oldIndex].cloneNode(true));
    }

    table.replaceChild(newTableBody,tbody);

This also works fine.

But the problem is, now, on click of the image button in last cell as described in the first part is not working. I put debugger in that javascript function and it hits there and forms the text and assigns to the innerHTML of the last td, but in page I don’t see the textbox.

In summary, the textbox is inserted as innerHTML before sorting, but after I do sorting with cloneNode, created a new sorted tBODY and inserted into the table, the innerHTML assigning is not working.

Any help is appreciated.

  • 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-06-11T18:53:49+00:00Added an answer on June 11, 2026 at 6:53 pm

    As a work around, i stopped doing cloneNode while sorting. Instead i did createElement and appendChild for each cell of the row and appendChild the row to the tbody

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

Sidebar

Related Questions

I have a table with some rows, each row has a unique key. When
I have added a insert/update trigger to a table that already has some rows.
I have a table that has some content in it. Not all rows has
I have a simple table that has this structure: <table> <thead> <tr> <td>Some info</td>
I have a table within my database that has many records, some records share
I have a table that has three different date columns, so I set each
I have a MySQL table from a third-party application that has millions of rows
I have a script that appends some rows to a table. One of the
So I have this website that has a search feature which searches a table
In my app I have SQLite database that has one table with date rows

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.