Hi there, i have been developing varius tables for storing data and system setting via the template node and eventually to be stored in some sort of sql. untill now i had to rely on adding a save button on the end of each row, and it has been ok so far. my next project will require to step it up a bit, so that i can save active row by clicking enter. so far i have been able to save first row only. please have a look at my code and give me suggestions how to progress, feel free to use my current code for whatever you might be able to
[{"id":"d273f858.444768","type":"ui_template","z":"1c7978bb.3c8757","group":"774c7a89.4f6d54","name":"sample","order":3,"width":"32","height":"10","format":"<style>\ntable.table-hover tr:hover {\n background:lightblue;\n } \n md-switch {\nposition: center; \nheight: 5px;\n}\nmd-switch .md-thumb {\n background-color: red;\n}\nmd-switch.md-checked .md-thumb {\n background-color: #33CC00;\n}\n\nmd-switch.md-checked .md-bar {\n background-color: lightgreen;\n}\n</style>\n<div class=\"scrollmenu\">\n<table cellpadding=\"1\" border=\"1\" id=\"table-2\" class=\"table-hover\" style=\"width: 100%; border-collapse: collapse; border: 1px solid black\">\n <thead>\n <tr>\n <th title=\"\" bgcolor=gray>Modified date</th>\n <th title=\"\" bgcolor=gray>Modified Type</th>\n <th title=\"\" bgcolor=gray>Modified by</th>\n <th title=\"\" bgcolor=gray>Installation</th>\n \n <th title=\"\" bgcolor=gray>Lagre</th>\n \n \n \n \n </tr>\n </thead>\n <tbody>\n <tr ng-repeat=\"row in msg.payload | limitTo:500\">\n <td><center>{{row.shortdate}}</center></td>\n <td contenteditable=\"true\" onclick=\"document.execCommand('selectAll')\"><center>{{row.modtype}}</center></td>\n <td contenteditable=\"true\" onclick=\"document.execCommand('selectAll')\"><center>{{row.modby}}</center></td>\n <td contenteditable=\"true\" onclick=\"document.execCommand('selectAll')\"><center>{{row.rigname}}</center></td>\n \n \n <td>\n <md-button id=\"lagre\" tr ng-click=\"sendRow($index+1)\">Lagre</md-button>\n </tr>\n \n </tbody>\n</table>\n<script type=\"text/javascript\">\n window.onload = function() {\n document.getElementById(\"editable\").focus();\n };\n\n</script>\n<script>\n $('#table-2').keypress(function(e){\n if(e.which == 13 && !e.shiftKey){//Enter key pressed\n e.preventDefault();\n $(\"#lagre\").click();\n alert('Endringer lagret: Vent litt for nye beregninger, trykk ok');\n //alert(document.getElementById(\"table1\").rows[obj].innerText);\n }\n });\n</script>\n\n\n<script>\n(function($scope) {\n$scope.sendRow = function(obj) {\nvar tableCells = document.getElementById(\"table-2\").rows.item(obj).cells;\nvar cellsData = [];\nfor (var j = 0; j < tableCells.length; j++) {\n cellsData[j] = tableCells.item(j).innerText;\n cellsData[j] = cellsData[j].replace(\",\",\".\"); \n}\n$scope.send({ \"payload\": cellsData });\n};\n})(scope);\n</script>\n\n</div>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":928,"y":219,"wires":[[]]},{"id":"774c7a89.4f6d54","type":"ui_group","z":"","name":"Grafer og tabeller","tab":"","order":1,"disp":true,"width":"32","collapse":false}]