diff --git a/module/bug/js/batchedit.js b/module/bug/js/batchedit.js index 571103fd1f..a66f0cf3f5 100644 --- a/module/bug/js/batchedit.js +++ b/module/bug/js/batchedit.js @@ -26,3 +26,31 @@ $(function() $(this).trigger("chosen:updated"); }); }) + +$(document).on('change', 'select', function() +{ + if($(this).val() == 'ditto') + { + var index = $(this).closest('td').index(); + var row = $(this).closest('tr').index(); + var $tbody = $(this).closest('tr').parent(); + + if($(this).attr('name').indexOf('resolutions') != -1) + { + index = $(this).closest('tr').closest('td').index(); + row = $(this).closest('tr').closest('td').parent().index(); + $tbody = $(this).closest('tr').closest('td').parent().parent(); + } + + var value = ''; + for(i = row - 1; i >= 0; i--) + { + value = $tbody.children('tr').eq(i).find('td').eq(index).find('select').val(); + if(value != 'ditto') break; + } + + $(this).val(value); + $(this).trigger("chosen:updated"); + $(this).trigger("change"); + } +})