ldapauth.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $(document).on('click', '.chosen-with-drop', function()
  2. {
  3. var select = $(this).prev('select');
  4. if($(select).val() == 'ditto')
  5. {
  6. var index = $(select).parents('td').index();
  7. var row = $(select).parents('tr').index();
  8. var table = $(select).parents('tr').parent();
  9. var value = '';
  10. for(i = row - 1; i >= 0; i--)
  11. {
  12. value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
  13. if(value != 'ditto') break;
  14. }
  15. $(select).val(value);
  16. $(select).trigger("chosen:updated");
  17. }
  18. })
  19. $(document).on('mousedown', 'select', function()
  20. {
  21. if($(this).val() == 'ditto')
  22. {
  23. var index = $(this).parents('td').index();
  24. var row = $(this).parents('tr').index();
  25. var table = $(this).parents('tr').parent();
  26. var value = '';
  27. for(i = row - 1; i >= 0; i--)
  28. {
  29. value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
  30. if(value != 'ditto') break;
  31. }
  32. $(this).val(value);
  33. }
  34. })
  35. $(function()
  36. {
  37. removeDitto(); //Remove 'ditto' in first row.
  38. })
  39. $(document).on('change', '[id^=visions]', function()
  40. {
  41. if($.inArray('ditto', $(this).val()) >= 0)
  42. {
  43. $(this).val('ditto');
  44. $(this).trigger("chosen:updated");
  45. }
  46. })