Tremblay
05-11-2005, 09:26 PM
The intranet site I'm working on has no backend database, so when I want to dynamically display table-based data, I do everything in Javascript.
Right now, I have all the data in Javascript arrays in the HTML files. E.g.:
NAME[1]="John";GENDER[1]="Male";CITY[1]="Denver";
NAME[2]="Bill";GENDER[2]="Male";CITY[2]="Memphis";
NAME[3]="Mary";GENDER[3]="Female";CITY[3]="Sacramento";
NAME[4]="Jill";GENDER[4]="Female";CITY[4]="New York";
Then I have forms to select different options, and then the user click "Submit" button and it will adds rows to a table for each match/result (using DOM functions like insertRow and insertCell). If the user clicks "Reset" button, it deletes all the rows from the table except the first one (header row);
That whole system works fine (a little slow when there are a lot of rows/results to display, but that's normal).
Now I have a data set where there are few rows, but a lot of columns. I don't want a side (left-right) scroll bar on the page, so I thought of turning the system 90 degrees, and add columns to the table for each result.
However they are no insertColumn function.
I've been trying to figure out a way to add/delete columns using DOM for 4 hours now and I can't think of anything...
Help!
Right now, I have all the data in Javascript arrays in the HTML files. E.g.:
NAME[1]="John";GENDER[1]="Male";CITY[1]="Denver";
NAME[2]="Bill";GENDER[2]="Male";CITY[2]="Memphis";
NAME[3]="Mary";GENDER[3]="Female";CITY[3]="Sacramento";
NAME[4]="Jill";GENDER[4]="Female";CITY[4]="New York";
Then I have forms to select different options, and then the user click "Submit" button and it will adds rows to a table for each match/result (using DOM functions like insertRow and insertCell). If the user clicks "Reset" button, it deletes all the rows from the table except the first one (header row);
That whole system works fine (a little slow when there are a lot of rows/results to display, but that's normal).
Now I have a data set where there are few rows, but a lot of columns. I don't want a side (left-right) scroll bar on the page, so I thought of turning the system 90 degrees, and add columns to the table for each result.
However they are no insertColumn function.
I've been trying to figure out a way to add/delete columns using DOM for 4 hours now and I can't think of anything...
Help!