Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / June 2005



Tip: Looking for answers? Try searching our database.

Insert row into tBody

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vic Sowers - 30 Jun 2005 05:12 GMT
I'm trying to sort an HTML table (tBody) on one of its columns dynamically.
My approach is to remove all the rows into an array, sort the array, and
insert to rows back into the tBody.

But, there doesn't seem to be any way to insert a pre-existing row into a
table (tBody). I've tried inserting a blank row and replacing it with the
saved row, but this fails as well.

I know about tBody.moveRow(from,to) (this works) but I have to sort the
table by hand, which is painfully slow.

Any suggestions?
mscir - 30 Jun 2005 05:39 GMT
> I'm trying to sort an HTML table (tBody) on one of its columns dynamically.
> My approach is to remove all the rows into an array, sort the array, and
[quoted text clipped - 8 lines]
>
> Any suggestions?

I'd take a look at these:

http://www.mattkruse.com/javascript/sorttable/index.html
http://www.brainjar.com/dhtml/tablesort/demo.html
http://webfx.eae.net/dhtml/sortabletable/demo.html
http://www.kryogenix.org/code/browser/sorttable/

Mike
Martin Honnen - 30 Jun 2005 12:25 GMT
> there doesn't seem to be any way to insert a pre-existing row into a
> table (tBody).

Why not, if you have the tbody element object you can use all the core
DOM methods like appendChild or insertBefore e.g.
  tbodyElement.appendChild(rowElement)

Signature

    Martin Honnen
    http://JavaScript.FAQTs.com/

Gérard Talbot - 30 Jun 2005 16:57 GMT
Martin Honnen wrote :

>> there doesn't seem to be any way to insert a pre-existing row into a
>> table (tBody).
>
> Why not, if you have the tbody element object you can use all the core
> DOM methods like appendChild or insertBefore e.g.
>   tbodyElement.appendChild(rowElement)

> there doesn't seem to be any way to insert a pre-existing row into a
table (tBody)

That is my conclusion too. I reported the whole thing to MSIE 7 dev.
team here:

http://channel9.msdn.com/wiki/default.aspx/Channel9.InternetExplorerProgrammingBugs
(See Other (Non-FORM) Elements issues section)

insertRow does not work like it should in MSIE 6. Of course, appendChild
 is a workaround.

Gérard
--
remove blah to email me
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.