tbl_relation.js 942 B

12345678910111213141516171819202122232425262728293031323334
  1. /* vim: set expandtab sw=4 ts=4 sts=4: */
  2. /**
  3. * for tbl_relation.php
  4. *
  5. */
  6. function show_hide_clauses($thisDropdown)
  7. {
  8. // here, one span contains the label and the clause dropdown
  9. // and we have one span for ON DELETE and one for ON UPDATE
  10. //
  11. if ($thisDropdown.val() != '') {
  12. $thisDropdown.parent().nextAll('span').show();
  13. } else {
  14. $thisDropdown.parent().nextAll('span').hide();
  15. }
  16. }
  17. /**
  18. * Unbind all event handlers before tearing down a page
  19. */
  20. AJAX.registerTeardown('tbl_relation.js', function() {
  21. $('select.referenced_column_dropdown').unbind('change');
  22. });
  23. AJAX.registerOnload('tbl_relation.js', function() {
  24. // initial display
  25. $('select.referenced_column_dropdown').each(function(index, one_dropdown) {
  26. show_hide_clauses($(one_dropdown));
  27. });
  28. // change
  29. $('select.referenced_column_dropdown').change(function() {
  30. show_hide_clauses($(this));
  31. });
  32. });