Hi, i have set up a template node to display a table of data from mysql.
the table is editable and my plan is to use it for editing values in mysql.
<!DOCTYPE HTML>
<html>
<head>
<title>sauer</title>
</head>
<body>
<table border="1" width="60%" id="table1">
<tr>
<th>SAU</th>
<th>GRUPPE</th>
<th>FEEDSTATION</th>
<tr ng-repeat="x in msg.payload | limitTo:50">
<td contenteditable="true">{{msg.payload[$index].animal}}</td>
<td contenteditable="true">{{msg.payload[$index].grup}}</td>
<td contenteditable="true">{{msg.payload[$index].station}}</td>
</tr>
</table>
<script language="javascript">
function convertTableIntoArray(tbl){
var tblData="";
var tblArr=[];
var value = tblArr;
tblLength = document.getElementById(tbl).rows.length;
for(i=0;i<tblLength;i++){
tblData="";
for(j=0;j<document.getElementById(tbl).rows[i].cells.length;j++){
tblData+=document.getElementById(tbl).rows[i].cells[j].innerHTML+",";
}
tblData=tblData.substring(0,tblData.length-1)
tblArr[i]=tblData.split(",");
}
console.log(tblArr);
}
</script>
<div>
<input type="button" value="Lagre" onclick="convertTableIntoArray('table1')"> //this button successfully sends my array to console.log
<md-button ng-click="send({payload:tblArr})"> //this button i want to use for sending the same array to msg.payload. so far no luck :-(
Click me
</md-button>
</div>
</body>
</html>