Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18209
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: How to best update three columns |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <kdm9vn$ons$1@dont-email.me> |
| Date | 2013-01-22 20:21 +0100 |
| Message-ID | <XnsA150CF1952965eejj99@194.109.133.133> (permalink) |
Tony wrote on 22 jan 2013 in comp.lang.javascript:
> How to best update three columns
The Q for the "best" way is nonsensical in programming,
as there is nothing more variable than taste.
> I have three arrrays with values for columns TextValue, MeasureType
> and Time.
> Each index in the arrray correspond always to the index in table so
> TextValue[0] correspond to the first row and column 3 which is
> TextValue I want to loop through the table and update each column in
> the table with values from the corresponing three arrays.
> How can that be done ?
Why not show wat you allready tried first? That is usance here,
as it shows you are not just dodging payment of a programmer.
==============================
No need for all the id='..', they are error-prone.
Start counting at 0, not at 1,
stipulate this is the first table of the page,
using it's first tbody of that table,
and using an array of arrays,
try this:
var arr = [
['...','...','...'],
['...','...','...'],
['...','...','...'],
['...','...','...']
];
var rtop = arr.length - 1;
var ctop = arr[0].length - 1;
var t = document.getElementsByTagName('table')[0];
var tb = t.getElementsByTagName('tbody')[0];
for (var r = 0; r < rtop; r++)
for (var c = 0; c < ctop; c++)
tb.rows[r].cells[c].innerHTML = arr[r][c];
===================
not tested, too lazy.
You could do all kinds of sorting on the outer array,
by order of one of the inner arrays' elements,
while keeping the inner arrays intact.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to best update three columns "Tony" <tony.johansson@inport.com> - 2013-01-22 16:07 +0100
Re: How to best update three columns "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-22 20:21 +0100
Re: How to best update three columns "Tony" <tony.johansson@inport.com> - 2013-01-23 10:08 +0100
Re: How to best update three columns "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-23 11:26 +0100
Re: How to best update three columns Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-01-23 18:54 +0000
Re: How to best update three columns "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-24 10:01 +0100
Re: How to best update three columns Bart Van der Donck <bart@nijlen.com> - 2013-01-23 01:11 -0800
csiph-web