Attempt to creating array based of header table

This commit is contained in:
2021-02-01 20:44:14 +01:00
parent c4b41737c5
commit 3c72ddc63a
3 changed files with 26 additions and 3 deletions

2
.idea/workspace.xml generated
View File

@@ -307,7 +307,7 @@
<workItem from="1611757446709" duration="6743000" />
<workItem from="1611826821050" duration="10679000" />
<workItem from="1611915874625" duration="15194000" />
<workItem from="1612178634549" duration="12858000" />
<workItem from="1612178634549" duration="19873000" />
</task>
<task id="LOCAL-00077" summary="testing jenkins docker">
<created>1601453886631</created>

View File

@@ -131,6 +131,7 @@ function sleep(ms) {
}
function saveChanges(){
convertTableToJson();
generateJson();
}
@@ -147,3 +148,25 @@ function generateJson(){
};
document.write(JSON.stringify(newJson, null, 2));
}
// $("table tr").eq(row).find("td").eq(i%2).append("<img src='"+dataJson[i].imagen+"' width='100'/>");
function convertTableToJson(){
var table = $('#headerTable');
console.log("Length of header table: " + table.length);
console.log("Length of children of header table: " + table.children().length);
var hKey = new Array(table.children().length);
var hVal = new Array(table.children().length);
if(table.children().length == 0) return;
for(let i=1; i<table.children.length;i++){
hKey[i-1] = table.eq(i).eq(0).val();
hVal[i-1] = table.eq(i).eq(1).val();
console.log('Key='+hKey[i-1]+' Value='+hVal[i-1]);
}
}
//TODO: children is an array
// add class for each row
// divide table into th and tb
// children().eq(0).text()
// jsfiddle.net

View File

@@ -54,10 +54,10 @@
</div>
<div id="headers">
<table id="headerTable">
<tr>
<th>
<td>Name</td>
<td>Value</td>
</tr>
</th>
</table>
<table id="nextHeaderTable">
<tr>