Multi Row Table

Joined
Oct 18, 2015
Messages
5
Reaction score
0
I am using the below to create a table in JavaScript from an array...

But I want something a bit different than what I am getting below.

I want the ID to be 2 Rows high and on the far LEFT
I then want ObsID, SppBova, COMMON_NAME, Tier to be to the right of the ID but all on row 1
Then to the right of the ID and on the 2nd line I want GENUS, SPECIES, FedStatus, TaxaGrp

Can I modify the below to do this or is there an easier way? I need to do this in JS

var i;
var out = "<table id=t02>";
dojo.forEach(newarr, function (arr){
out += "<tr><td>" +
arr.id +
"</td><td>" +
arr.ObsID +
"</td><td>" +
arr.SppBova +
"</td><td>" +
arr.COMMON_NAME +
"</td><td>" +
arr.GENUS +
"</td><td>" +
arr.SPECIES +
"</td><td>" +
arr.Tier +
"</td><td>" +
arr.FedStatus +
"</td><td>" +
arr.TaxaGrp +
"</td></tr>";
});
out += "</table>";
document.getElementById("id02").innerHTML = out;
 
Joined
Oct 18, 2015
Messages
5
Reaction score
0
Tried something like this but its all messed up

var i;
var out = "<table id=t02>";
dojo.forEach(newarr, function (arr){
out += "<tr><td rowspan='2'>" +
arr.COMMON_NAME +
"</tr></td><tr><td rowspan='2'>" +
arr.GENUS +
"</td><td rowspan='2'>" +
arr.SPECIES +
"</td><td rowspan='2'>" +
arr.Tier +
"</td></tr><tr><td rowspan='2'>" +
arr.FedStatus +
"</td><td rowspan='2'>" +
arr.TaxaGrp +
"</td></tr>";
});
out += "</table>";
document.getElementById("id02").innerHTML = out;
 
Joined
Oct 18, 2015
Messages
5
Reaction score
0
I did this and got the attached...getting closer....

var i;
var out = "<table id=t02>";
dojo.forEach(newarr, function (arr){
out += "<tr><th>CommonName</th><th>GENUS</th><th>SPECIES</th></tr>" +
"<tr><td rowspan='2'>" + arr.COMMON_NAME + "</td>" +
"<td rowspan='1'>" + arr.GENUS + "</td>" +
"<td rowspan='1'>" + arr.SPECIES + "</td></tr>";
});
out += "</table>";
document.getElementById("id02").innerHTML = out;

}
 

Attachments

  • MULTILINE_TABLE.jpg
    MULTILINE_TABLE.jpg
    113.3 KB · Views: 374

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top