* adjust for task #2531:Process the post data in model when value is 'ditto'.
This commit is contained in:
+23
-15
@@ -8,36 +8,44 @@ $(function()
|
||||
});
|
||||
})
|
||||
|
||||
$(document).on('click', '.chosen-with-drop', function()
|
||||
{
|
||||
var $select = $(this).prev('select');
|
||||
oldValue = $select.val();
|
||||
})
|
||||
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})
|
||||
|
||||
$(document).on('change', 'select', function()
|
||||
{
|
||||
if($(this).val() == 'ditto')
|
||||
{
|
||||
var index = $(this).closest('td').index();
|
||||
var row = $(this).closest('tr').index();
|
||||
var table = $(this).closest('tr').parent();
|
||||
var index = $(this).closest('td').index();
|
||||
var row = $(this).closest('tr').index();
|
||||
var $tbody = $(this).closest('tr').parent();
|
||||
|
||||
var value = '';
|
||||
for(i = row - 1; i >= 0; i--)
|
||||
{
|
||||
value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
|
||||
value = $tbody.children('tr').eq(i).find('td').eq(index).find('select').val();
|
||||
if(value != 'ditto') break;
|
||||
}
|
||||
|
||||
var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ',';
|
||||
if(valueStr.indexOf(',' + value + ',') != -1)
|
||||
|
||||
isModules = $(this).attr('name').indexOf('modules') != -1;
|
||||
isAssignedTos = $(this).attr('name').indexOf('assignedTos') != -1;
|
||||
isFinishedBys = $(this).attr('name').indexOf('finishedBys') != -1;
|
||||
isClosedBys = $(this).attr('name').indexOf('closedBys') != -1;
|
||||
|
||||
if(isModules || isAssignedTos || isFinishedBys || isClosedBys)
|
||||
{
|
||||
$(this).val(value);
|
||||
var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ',';
|
||||
if(valueStr.indexOf(',' + value + ',') != -1)
|
||||
{
|
||||
$(this).val(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(dittoNotice);
|
||||
$(this).val(oldValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(dittoNotice);
|
||||
$(this).val(oldValue);
|
||||
$(this).val(value);
|
||||
}
|
||||
|
||||
$(this).trigger("chosen:updated");
|
||||
|
||||
Reference in New Issue
Block a user