473,770 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clearing all elements from within a named table.

Daz
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 ('idOfTableToBi ndTo').

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.

Nov 17 '06 #1
4 1635
Hi Daz,

Daz wrote:
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

Nov 17 '06 #2
Daz

Peter Michaux wrote:
Hi Daz,

Daz wrote:
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.

Nov 17 '06 #3
Daz wrote:
Peter Michaux wrote:
Hi Daz,

Daz wrote:
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

Nov 18 '06 #4
Daz

Daz wrote:
Peter Michaux wrote:
Hi Daz,

Daz wrote:
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...

Nov 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6783
by: Doug Estep | last post by:
Below is a sample of my XML… <MetaData> <Table name="mytable"> <PrimaryKey name="pk"><Column name="mycolumn"/></PrimaryKey> </Table> </MetaData> <Sequencer> <Table name="mytable">
9
8828
by: Stanimir Stamenkov | last post by:
Using Xerces2 Java I'm trying to validate a CSV data following an XNI example <http://xml.apache.org/xerces2-j/xni-config.html#examples>. The CSV scanner generates XML tree events like: <csv> <row> <col>Andy Clark</col> <col>16 Jan 1973</col> <col>Cincinnati</col>
2
5240
by: Falc2199 | last post by:
i all, I have an HTML table within which I have a span. When the user clicks a button I want to update the contents of this span with form elements table elements (TR,TD). The problem is that if I do not wrap the span tag inside a TR and TD, it is not properly placed in the table and the update does not work at all. However if I do place the span inside a TR and TD, the TR and TD which was supposed to go into the span is not becoming...
15
2101
by: Christopher Benson-Manica | last post by:
When are named elements written with script accessible to script? <html><head><script type="text/javascript"> function ready() { alert( document.getElementsByName("div").length ); } </script></head> <body onload="ready()"> <script type="text/javascript"> document.open();
33
2867
by: abs | last post by:
Hi all. My list: <ul> <li id="a" onclick="show(this)">Aaaaaaaa</li> <li id="b" onclick="show(this)">Bbbbbbbb</li> <li id="c" onclick="show(this)">Cccccccc <ul> <li id="d" onclick="show(this)">111111</li>
8
1585
by: David | last post by:
I wonder if someone could tell me where I am going wrong with this script. The original implementation of finding a DL list and separating it by dt | dd groups and making new DL's from them worked good. It found only one DL by getElementById. The problem I am having is now to process multiple lists in which are found now by a unique class name on the DL instead of getElementById and only processing one DL. I'm not really sure how to...
4
12768
by: Claudio Calboni | last post by:
Hello folks, I'm having some performance issues with the client-side part of my application. Basically, it renders a huge HTML table (about 20'000 cells in my testing scenario), without content. Content is "pushed" from the back via some JS, for the only displayed portion of table. Once the user scrolls, JS updates visible cells with data. It's quite the philosophy behind GMaps and similars. So, the server says to JS "update this group...
1
2455
by: Esteban404 | last post by:
//using C# 2005, MS SQL 2000(prod) and SQL Express 2005 (dev) My sprocs all have a clearing mechanism at the end like this for each temporary table I use: --drop temporary tables IF EXISTS(SELECT name FROM ..sysobjects WHERE name = N'#Temp' AND xtype='U') DROP TABLE #Temp Every once in a while, something will happen to cause a hiccup and the table doesn't clear. The result is no results, not an error message (reader fails). I added the...
3
2212
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus that are SELECT elements (javascript-- one named arrivalcity and one named returncity). Basically they ask for a departure and return city and another menu appears with options based on that city. I can't seem to get the input from these fields in the...
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9439
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.