blob: 4fdd8659ff9af7a083512405db6a46eb1daa9472 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
function radio_column(chip) {
col = document.createElement("td");
radio = document.createElement("input");
radio.setAttribute("type", "radio");
radio.setAttribute("name", "genechipid");
radio.setAttribute("value", chip["GeneChipId"]);
radio.setAttribute("required", "required");
col.appendChild(radio);
return col;
}
function setup_genechips(genechip_data) {
columns = ["GeneChipId", "GeneChipName"]
submit_button = document.querySelector(
"#select-platform-form button[type='submit']");
elt = document.getElementById(
"genechips-table").getElementsByTagName("tbody")[0];
remove_children(elt);
if((genechip_data === undefined) || genechip_data.length === 0) {
row = document.createElement("tr");
col = document.createElement("td");
col.setAttribute("colspan", "3");
text = document.createTextNode("No chips found for selected species");
col.appendChild(text);
row.appendChild(col);
elt.appendChild(row);
submit_button.setAttribute("disabled", true);
return false;
}
submit_button.removeAttribute("disabled")
genechip_data.forEach(chip => {
row = document.createElement("tr");
row.appendChild(radio_column(chip));
columns.forEach(column => {
col = document.createElement("td");
content = document.createTextNode(chip[column]);
col.appendChild(content);
row.appendChild(col);
});
elt.appendChild(row);
});
}
function genechips() {
return JSON.parse(
document.getElementById("select-platform-form").getAttribute(
"data-genechips"));
}
function update_genechips(event) {
genec = genechips();
species_elt = document.getElementById("species");
if(event.target == species_elt) {
setup_genechips(genec[species_elt.value.toLowerCase()]);
}
}
function select_row_radio(row) {
radio = row.getElementsByTagName(
"td")[0].getElementsByTagName(
"input")[0];
if(radio === undefined) {
return false;
}
radio.setAttribute("checked", "checked");
return true;
}
|