473,406 Members | 2,894 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,406 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 4757


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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.