Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 17th, 2006, 04:25 PM
Daz
Guest
 
Posts: n/a
Default Clearing all elements from within a named table.

Hello everyone. I have a simple problem which can be solved quite
simply, I am just going about it the wrong way. I would like to wipe
every row from within a named table, but I am not too sure how to do
it.

Each of these rows, are part of a JavaScript Object, which is bound to
the table by objectName.bind('idOfTableToBindTo').

I have tried to destroy the objects themselves, but they still remain.
Perhaps I am doing something wrong... I have tried to make a function
that will loop through all of the 'tr' elements withing the table, and
failed dismally. I know that this can be done, I just can't seem to
figure out how.

As my object can be bound to the table, but still remains when I delete
the variable pointing to the object (which I thought would delete the
object itself).

Is there any way that I can put a function within my object that will
make it destroy itself?

I would assume that an object can't destroy itself, and that it needs
to be done externally, but I am not sure, as I am just assuming.

Please could someone suggest a method I can use to loop through all of
the childElements in a table and delete them?

Also, is there a way to actually delete the object itself, rather than
just the variable pointing to it. It may be the case that it's already
deleting the object, but it doesn't look like it. The more I think
about what it's doing, the more I confuse myself about the entire
issue.

All the best.

Daz.

  #2  
Old November 17th, 2006, 11:15 PM
Peter Michaux
Guest
 
Posts: n/a
Default Re: Clearing all elements from within a named table.

Hi Daz,

Daz wrote:
Quote:
Hello everyone. I have a simple problem which can be solved quite
simply, I am just going about it the wrong way. I would like to wipe
every row from within a named table, but I am not too sure how to do
it.
Can you post a complete example (HTML with JavaScript in head element)
in 30 lines or less that shows how you are trying to do this?

Peter

  #3  
Old November 17th, 2006, 11:55 PM
Daz
Guest
 
Posts: n/a
Default Re: Clearing all elements from within a named table.


Peter Michaux wrote:
Quote:
Hi Daz,
>
Daz wrote:
Quote:
Hello everyone. I have a simple problem which can be solved quite
simply, I am just going about it the wrong way. I would like to wipe
every row from within a named table, but I am not too sure how to do
it.
>
Can you post a complete example (HTML with JavaScript in head element)
in 30 lines or less that shows how you are trying to do this?
>
Peter
Hi Peter. I'm not entirely sure. The class itself is about 250 lines,
as it creates a LOT of DOM elements on-the-fly. Would you like me to
try and summerise it?

Everything works in the code, I just cannot seem to remove or unbind
the elements once they have been added to the table. Once again, I know
this is possible, I just don't know any methods to achieve this, and
those I have tried have failed.

  #4  
Old November 18th, 2006, 12:15 AM
Peter Michaux
Guest
 
Posts: n/a
Default Re: Clearing all elements from within a named table.

Daz wrote:
Quote:
Peter Michaux wrote:
>
Quote:
Hi Daz,

Daz wrote:
Quote:
Hello everyone. I have a simple problem which can be solved quite
simply, I am just going about it the wrong way. I would like to wipe
every row from within a named table, but I am not too sure how to do
it.
Can you post a complete example (HTML with JavaScript in head element)
in 30 lines or less that shows how you are trying to do this?

Peter
>
Hi Peter. I'm not entirely sure. The class itself is about 250 lines,
as it creates a LOT of DOM elements on-the-fly. Would you like me to
try and summerise it?
You may sort it out yourself as you do this.

Peter

  #5  
Old November 18th, 2006, 12:15 AM
Daz
Guest
 
Posts: n/a
Default Re: Clearing all elements from within a named table.


Daz wrote:
Quote:
Peter Michaux wrote:
>
Quote:
Hi Daz,

Daz wrote:
Quote:
Hello everyone. I have a simple problem which can be solved quite
simply, I am just going about it the wrong way. I would like to wipe
every row from within a named table, but I am not too sure how to do
it.
Can you post a complete example (HTML with JavaScript in head element)
in 30 lines or less that shows how you are trying to do this?

Peter
>
Hi Peter. I'm not entirely sure. The class itself is about 250 lines,
as it creates a LOT of DOM elements on-the-fly. Would you like me to
try and summerise it?
>
Everything works in the code, I just cannot seem to remove or unbind
the elements once they have been added to the table. Once again, I know
this is possible, I just don't know any methods to achieve this, and
those I have tried have failed.
Ok, I have an update to my previous post. I am using the Web Developer
Extension for Firefox, and I have spotted something rather odd. As I
mentioned before, my objects are created within a table row, and bind
to a hard-coded table in my document. I have enabled table and cell
outlining with the Web Developer Extension, and the table for that my
objects are bound to is outlines, as are the newly appended rows.
However, the old rows are non-existent (which is a good thing), but the
new rows are inserted from the point where the last rows ended. So I
have a blank section at the top of my table. Each time I press the
submit button to make the calculations, delete the right elements and
then make new objects and append them to the table, the new objects are
always inserted at the point where the old objects ended before they
were deleted.

Basically, Each time I press the submit button, the old
objects/elements are cleared, but the new ones are shifted down the
table. If I push the submit button three times, the new rows disappear
from the bottom of the page...

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.