mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Correzioni per gli attributi nelle opzioni select
This commit is contained in:
parent
8cf1fb1ea0
commit
eee9e08913
@ -289,5 +289,27 @@ function initDynamicSelectInput(input) {
|
||||
},
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
// Rimozione delle option presenti nell'HTML per permettere l'aggiornamento dei dati via AJAX
|
||||
// Rimozione per select multipli
|
||||
if ($input.prop("multiple")) {
|
||||
$input.on('select2:unselecting', function (e) {
|
||||
let data = e.params ? e.params.data : null;
|
||||
if (data) {
|
||||
let option = $input.find('option[value="' + data.id + '"]');
|
||||
option.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
// Rimozione per select singoli
|
||||
else {
|
||||
$input.on('select2:selecting', function (e) {
|
||||
let data = $input.selectData();
|
||||
if (data) {
|
||||
let option = $input.find('option[value="' + data.id + '"]');
|
||||
option.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user