Created
August 16, 2016 16:35
-
-
Save e-vural/03fc6d355f69aaa4e214c05e475bfe98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select2.on('select2:select',function() { | |
var id = $(this).find('option:selected').text().replace(/\s/g,'_'); | |
$(this).closest('td').siblings('td').find('select.select2').children('option[id="' + id + '"]').attr('disabled', true); | |
var selected_option = $(this).find('option:selected'); | |
var selected_all_options = $(this).closest('td').siblings('td').find('select.select2').children('option:selected') | |
selected_all_options.push(selected_option) | |
var aar = [] | |
$.each(selected_all_options, function (i,val) { | |
var selected_id = $(val).attr('id'); | |
if(selected_id && selected_id != 'undefined'){ | |
var asse = '#'+selected_id; | |
aar.push(asse); | |
} | |
}) | |
$(this).closest('td').siblings('td').find('select.select2').children('option').not(aar.join(',')).removeAttr('disabled'); | |
select2.select2({ | |
width: 'off', | |
placeholder: 'Lütfen Seçiniz', | |
language: _locale, | |
allowClear: true, | |
escapeMarkup: function (m) { | |
return m; | |
}, | |
theme: 'bootstrap' | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment