table.html 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>table-confirm-delete</title>
  6. <script src="../../dist/jsoneditor.js"></script>
  7. </head>
  8. <body>
  9. <textarea class="debug" cols="30" rows="10"></textarea>
  10. <button class='get-value'>Get Value</button>
  11. <div class='container'></div>
  12. <script>
  13. var container = document.querySelector('.container');
  14. var debug = document.querySelector('.debug');
  15. var schema = {
  16. "type": "array",
  17. "format": "table",
  18. "title": "Nodes",
  19. "items": {
  20. "type": "object",
  21. "title": "Node",
  22. "properties": {
  23. "node": {
  24. "type": "string",
  25. "title": "I am a node"
  26. }
  27. }
  28. }
  29. };
  30. var editor = new JSONEditor(container, {
  31. schema: schema
  32. });
  33. // editor.options.prompt_before_delete = false;
  34. document.querySelector('.get-value').addEventListener('click', function () {
  35. debug.value = JSON.stringify(editor.getValue());
  36. });
  37. </script>
  38. </body>
  39. </html>