Hy community,
im struggling long time now with this:
I want to do my own task/shopping list using node red and sqlite.
So far:
- Sqlite works.
- Feeding through dashboard works.
- Doing select statemnts to show specific tagged tasks work.
- Closing tasks in ui template does not work (see below).
In each column of a table there is a button. When clicked, the task with a specific id shall be set to "done".
But it doesnt work.. my html/javascript is not the best, Any suggestions?
ui template:
<h>{{msg.listshown}}</h>
<table style="width:100%">
<tr>
<th>id</th>
<th>task</th>
<th>duedate</th>
<th>status</th>
</tr>
<tr ng-repeat="x in msg.payload | limitTo:50">
<td>{{msg.payload[$index].id}}</td>
<td>{{msg.payload[$index].task}}</td>
<td>{{msg.payload[$index].duedate}}</td>
<td> <button onclick="CloseTask()">done</button> </td>
</tr>
</table>
<script>
function CloseTask()
{
msg.topic="UPDATE rtm SET status = 'DONE' WHERE id = '" + {{msg.payload[$index].id}} + "'";
return msg;
}
</script>