Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18217
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: How to best update three columns |
| Date | 2013-01-23 10:08 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <kdo9a0$3v6$1@dont-email.me> (permalink) |
| References | <kdm9vn$ons$1@dont-email.me> <XnsA150CF1952965eejj99@194.109.133.133> |
I mentioned before that we had three arrrays containing the columns
TextValue, MeasureType
and Time.
As matter of fact we haven't decided yet how the data structure we receive
from server should look like.
So I ask here what would be the best and easiest data structure to use if I
want to update the table I asked in the first mail ?
Assume also that we can send all the data in all five columns.
I have worked with ASP.NET where we use binding but it's not possible here
when I use xhtml and javascript
//Tony
"Evertjan." wrote in message news:XnsA150CF1952965eejj99@194.109.133.133...
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