473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Dynamic Table

Hi Guyz,

I am trying to make a dynamic table which will automatically update
after running a query.
My Table contains 4 columns.

I am trying to update the table by adding rows of information to it.
But i am able to add only one column, how can i insert 4 columns and
make the table resize automatically.

My Function.
function getRoomDetails()
{

var table = document.getElementById('roomTable');
var row = document.createElement("tr");
var cell = document.createElement("td");
var cell2 = document.createElement("td");
var cell3 = document.createElement("td");
var cell4 = document.createElement("td");
var cellText = document.createTextNode("Column 1");
var cellText1 = document.createTextNode("Column 2");
var cellText2 = document.createTextNode("Column 3");
var cellText3 = document.createTextNode("Column 4");
cell.appendChild(cellText);
cell1.appendChild(cellText1);
cell2.appendChild(cellText2);
cell3.appendChild(cellText4);
row.appendChild(cell);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell5);
table.appendChild(row);

}

any help would be appreciated.

Thanks,
Hj

Jan 25 '07 #1
2 4747


On Jan 25, 3:01 pm, "jainharsh" <jain.perso...@gmail.comwrote:
Hi Guyz,

I am trying to make a dynamic table which will automatically update
after running a query.
My Table contains 4 columns.

I am trying to update the table by adding rows of information to it.
But i am able to add only one column, how can i insert 4 columns and
make the table resize automatically.

My Function.
function getRoomDetails()
{

var table = document.getElementById('roomTable');
var row = document.createElement("tr");
var cell = document.createElement("td");
var cell2 = document.createElement("td");
var cell3 = document.createElement("td");
var cell4 = document.createElement("td");
var cellText = document.createTextNode("Column 1");
var cellText1 = document.createTextNode("Column 2");
var cellText2 = document.createTextNode("Column 3");
var cellText3 = document.createTextNode("Column 4");
cell.appendChild(cellText);
cell1.appendChild(cellText1);
cell2.appendChild(cellText2);
cell3.appendChild(cellText4);
row.appendChild(cell);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell5);
table.appendChild(row);

}any help would be appreciated.

Thanks,
Hj
Make sure you're appending the tr to either a thead or a tbody.

- Craig Taylor
http://www.ctalkobt.net

Jan 25 '07 #2
jainharsh wrote :
Hi Guyz,

I am trying to make a dynamic table which will automatically update
after running a query.
My Table contains 4 columns.

I am trying to update the table by adding rows of information to it.
But i am able to add only one column, how can i insert 4 columns and
make the table resize automatically.
Then do not set the table width otherwise you will be over-constraining
the table.
And as mentioned by Craig, append the table rows to a table section
(thead or tbody) because IE 6+ has a known bug on this.

Dynamically creating, populating and inserting a table
http://www.gtalbot.org/DHTMLSection/CreatingTable.html

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Jan 25 '07 #3

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

Similar topics

4
by: Tim.D | last post by:
People, I've ventured into the wonderful world of Stored Procedures. My first experience has been relatively successful however I am stuck on using host variables to specifiy actualy table or...
14
by: Ina Schmitz | last post by:
Hello, I would like to get the logical and physical reads for every sql statement executed. Thatfore, I used the command "db2 get snapshot for dynamic sql on <mydatabase>". There, I could see...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
3
by: CAD Fiend | last post by:
Hello, Well, after an initial review of my database by my client, they have completely changed their minds about how they want their form. As a result, I'm having to re-think the whole process....
1
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new...
7
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
6
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night,...
12
by: ive1122 | last post by:
Hi guys, I am looking into create a dynamic survey as posted in Get User Input From Dynamic Controls but with some different environment Below is what i am trying to do: First when the user...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.