Hello, I want to enable the checkbox clicking the Boton 1 and then enable the boton 2 when the checkbox is checked.
I was able to achieve that when the checkbox is checked the Boton 2 was enable, but when i did the same with the checkboxes (pressing Boton 1 Enable All the checkboxes) it did´t work. Only work for the first checkbox of the table.
[{"id":"df5a1c69e7c3c33e","type":"inject","z":"71fbc1b8432e4c83","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"Marca\":\"Marca1\",\"Vencimiento\":\"Vencimiento1\",\"Modelo\":\"Modelo1\",\"id\":1},{\"Marca\":\"Marca2\",\"Vencimiento\":\"Vencimiento2\",\"Modelo\":\"Modelo2\",\"id\":2},{\"Marca\":\"Marca3\",\"Vencimiento\":\"Vencimiento3\",\"Modelo\":\"Modelo3\",\"id\":3},{\"Marca\":\"Marca4\",\"Vencimiento\":\"Vencimiento4\",\"Modelo\":\"Modelo4\",\"id\":4},{\"Marca\":\"Marca5\",\"Vencimiento\":\"Vencimiento5\",\"Modelo\":\"Modelo5\",\"id\":5}]","payloadType":"json","x":550,"y":340,"wires":[["33c971a311314e52"]]},{"id":"33c971a311314e52","type":"ui_template","z":"71fbc1b8432e4c83","group":"95d436df7bf84561","name":"","order":1,"width":14,"height":15,"format":"<div class=\"main\">\n \n<div class=\"borde\">\n<input type=\"button\" class=\"boton\" value=\"boton 1\" onclick=\"check3()\" id=\"boton1\"/>\n\n</md-button>\n<div/>\n\n <table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#D0D0D0\" id=\"Table1\" style=\"width:100%\">\n <tr class=\"fondotitulo\">\n <th>Marca</th>\n <th>Vencimiento</th>\n <th>Modelo</th>\n <th>Id</th>\n <th>✔</th>\n\n </tr>\n <tr ng-repeat=\"x in msg.payload | limitTo:100\">\n\n <td class=\"fondotabla\" style=\"text-align:center;\">{{x.Marca}}</td>\n <td class=\"fondotabla\" style=\"text-align:center;\">{{x.Vencimiento}}</td>\n <td class=\"fondotabla\" style=\"text-align:center;\">{{x.Modelo}}</td>\n <td class=\"fondotabla\" style=\"text-align:center;\">{{x.id}}</td>\n <td class=\"fondotabla\" style=\"text-align:center;\">\n <input data-id=\"{{x.id}}\" data-marca=\"{{x.Marca}}\" data-vencimiento=\"{{x.Vencimiento}}\" data-modelo=\"{{x.Modelo}}\" type=\"checkbox\" onclick=\"enable()\" id=\"checkbox\"/>\n </td>\n </tr>\n </table>\n\n</div>\n\n\n<div class=\"borde\">\n<input type=\"button\" class=\"boton\" value=\"Boton 2\" onclick=\"check2()\" id=\"boton2\" />\n\n</md-button>\n</div>\n</div>\n</div>\n<script type=\"text/javascript\">\n\ndocument.getElementById(\"boton2\").disabled = true;\n\n//document.getElementById(\"checkbox\").disabled = true;\n\n//Declare once to make scope available in functions\nvar theScope = scope;\n\nfunction enable(){\n document.getElementById(\"boton2\").disabled = false;\n} \n \n \n \n \n function check() {\n //Reference the Table.\n var grid = document.getElementById(\"Table1\");\n \n //Reference the CheckBoxes in Table.\n var checkBoxes = grid.getElementsByTagName(\"INPUT\");\n //console.log(checkBoxes)\n \n\n let selected = []\n //Loop through the CheckBoxes.\n for (var i = 0; i < checkBoxes.length; i++) {\n if (checkBoxes[i].checked) {\n var id = checkBoxes[i].dataset.id;\n var marca = checkBoxes[i].dataset.marca;\n var vencimiento = checkBoxes[i].dataset.vencimiento;\n var modelo = checkBoxes[i].dataset.modelo;\n \n selected.push( {id, marca, vencimiento, modelo})\n }\n }\n\n //console.log(selected)\ntheScope.send({payload:selected}) // send back top NR\n\n \n }\n \n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","x":720,"y":340,"wires":[["1f90549fc7aa897a"]]},{"id":"1f90549fc7aa897a","type":"debug","z":"71fbc1b8432e4c83","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":960,"y":340,"wires":[]},{"id":"5f3c1cdb4b121977","type":"ui_template","z":"71fbc1b8432e4c83","group":"95d436df7bf84561","name":"Estilo Css","order":2,"width":0,"height":0,"format":"<style>\n\n.main\n{\n height:500px;\n}\n.datos{\n width: 100px;\n\n}\n.fondotabla{\n background-color:#FFFDE7; \n\n \n}\n\n\n.fondotitulo{\n background-color:#FCF799; \n \n \n}\n.contenedor{\n \n \n \n \n \n \n}\n.boton{\nbackground-color:#FCF799; \nwidth:200px;\nheight:40px;\nborder:none;\nborder-radius: 8px;\noutline: none;\n\n\n}\n\n.boton:hover{\n Background-color:#FFFDE7;\n transition:all .4s ease;\n box-shadow:0.5px 1px 11px 0px rgba(89,87,87,0.85);\n}\n\n.boton:active {\n background-color:#FCF799; \n transition:all .05s ease;\n}\n \n.borde{\nborder:2px solid #d0d0d0;\nborder-radius: 8px;\nwidth:200px;\nheight:40px;\nmargin-left:40%;\nborder-radius: 8px;\nmargin-top:1%;\n}\n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":720,"y":260,"wires":[[]]},{"id":"95d436df7bf84561","type":"ui_group","name":"prueba","tab":"4a5d91cd891c3256","order":1,"disp":true,"width":14,"collapse":false},{"id":"4a5d91cd891c3256","type":"ui_tab","name":"prueba","icon":"dashboard","order":15,"disabled":false,"hidden":false}]
Thanks, Lucas