examples.nestable.js 591 B

1234567891011121314151617181920212223242526272829303132333435
  1. (function( $ ) {
  2. 'use strict';
  3. /*
  4. Update Output
  5. */
  6. var updateOutput = function (e) {
  7. var list = e.length ? e : $(e.target),
  8. output = list.data('output');
  9. if (window.JSON) {
  10. output.val(window.JSON.stringify(list.nestable('serialize')));
  11. } else {
  12. output.val('JSON browser support required for this demo.');
  13. }
  14. };
  15. /*
  16. Nestable 1
  17. */
  18. $('#nestable').nestable({
  19. group: 1
  20. }).on('change', updateOutput);
  21. /*
  22. Output Initial Serialised Data
  23. */
  24. $(function() {
  25. updateOutput($('#nestable').data('output', $('#nestable-output')));
  26. });
  27. }).apply(this, [ jQuery ]);