javascript - Editable table cells with App Inventor -
i building app app inventor. use webviewer
load javascript code (see below) displays, in table, content of database stored in tinydb
.
so have table looks that:
i've tried make content of table editable adding @ bottom of script without success: table disappears.
<script> function myfunction() { document.getelementbyid("mytable").contenteditable = true; } </script>
also i've seen page. can't find way implement .js
in app inventor app.
any idea how make work?
<body> <div id="mytable"></div> <script> // table display window.appinventor object , split @ new line var urlarray = window.appinventor.getwebviewstring().split("\n"); var doc = document; var fragment = doc.createdocumentfragment(); for(i=0;i<urlarray.length;i++){ var tr = doc.createelement("tr"); // split @ comma var rowarray = urlarray[i].split("|"); for(j=0;j<rowarray.length;j++){ if ( == 0) { var td = doc.createelement("th"); } else { var td = doc.createelement("td"); } td.innerhtml = rowarray[j]; tr.appendchild(td); fragment.appendchild(tr); } } var table = doc.createelement("table"); table.appendchild(fragment); doc.getelementbyid("mytable").appendchild(table); </script> </body>
Comments
Post a Comment