Attempt to creating array based of header table
This commit is contained in:
2
.idea/workspace.xml
generated
2
.idea/workspace.xml
generated
@@ -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>
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user