update dossier chekcqual
This commit is contained in:
+18
-8
@@ -880,10 +880,13 @@ include('include/trfqueryscript.php'); ?>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#charact_result').select2();
|
||||
$('#charact_result').select2({
|
||||
placeholder: "<?php echo $pleaseselectstd; ?>", // Placeholder aggiunto
|
||||
allowClear: true // Opzione per consentire di cancellare la selezione
|
||||
});
|
||||
});
|
||||
// Use the plugin once the DOM has been loaded.
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// country dependent ajax
|
||||
$(document).on("change", "#articletype_change", function(e) {
|
||||
@@ -952,20 +955,27 @@ include('include/trfqueryscript.php'); ?>
|
||||
success: function(response)
|
||||
|
||||
{
|
||||
$('#charact_result').html('').select2();
|
||||
//var charactBody = "";
|
||||
// charactBody = "<option>-- Seleziona --</option>"
|
||||
$('#charact_result').html('').select2({
|
||||
placeholder: "<?php echo $pleaseselectstd; ?>", // Placeholder visibile quando vuoto
|
||||
allowClear: true // Aggiunge la 'X' per cancellare la selezione
|
||||
});
|
||||
|
||||
// Aggiunge un’opzione vuota per il placeholder
|
||||
var emptyOption = new Option("", "", false, false);
|
||||
$('#charact_result').append(emptyOption);
|
||||
|
||||
for (var key in response) {
|
||||
var characteristicNameVar = "<?php echo ($_SESSION['langselect'] == 'it') ? 'name_articlecharacteristic' : 'name_articlecharacteristic_eng'; ?>";
|
||||
var newOption = new Option(response[key][characteristicNameVar], response[key]['idarticlecharacteristic'], false, false);
|
||||
|
||||
$('#charact_result').append(newOption).trigger('change');
|
||||
//charactBody += "<option value="+ response[key]['idarticlecharacteristic'] +">"+ response[key]['name_articlecharacteristic'] +"</option>";
|
||||
//$("#charact_result").html(charactBody);
|
||||
$('#charact_result').append(newOption); // Aggiunge dinamicamente le opzioni
|
||||
}
|
||||
|
||||
$('#charact_result').trigger('change'); // Trigger per aggiornare Select2 dopo il popolamento
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user