Files
EasySoft-ZenTaoPMS/module/story/js/batchcreate.js
2014-11-05 09:16:31 +00:00

44 lines
1.3 KiB
JavaScript

$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
if($(select).val() == 'same')
{
var index = $(select).parents('td').index();
var row = $(select).parents('tr').index();
var table = $(select).parents('tr').parent();
var value = '';
for(i = row - 1; i >= 0; i--)
{
value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
if(value != 'same') break;
}
$(select).val(value);
$(select).trigger("chosen:updated");
}
});
$(document).on('mousedown', 'select', function()
{
if($(this).val() == 'same')
{
var index = $(this).parents('td').index();
var row = $(this).parents('tr').index();
var table = $(this).parents('tr').parent();
var value = '';
for(i = row - 1; i >= 0; i--)
{
value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
if(value != 'same') break;
}
$(this).val(value);
}
})
if(navigator.userAgent.indexOf("Firefox") < 0)
{
$(document).on('input keyup paste change', 'textarea.autosize', function()
{
this.style.height = 'auto';
this.style.height = (this.scrollHeight + 2) + "px";
});
}