/* Construction dynamique des valeurs de point en fonction de l'implantation choisie */
function charger_valeurs_point(implantation_id) {
var params = {'implantation_id' : implantation_id};
- $.getJSON('/dae/liste_valeurs_point', params, function(data) {
- var items = [];
+ var chargement_vp = $.getJSON('/dae/liste_valeurs_point', params);
+ chargement_vp.success(function(data) {
+ var items = [];
- var options = "";
- $.each(data, function() {
- options += '<option value="' + this.id + '">' + this.label + '</option>';
- });
+ var options = "";
+ $.each(data, function() {
+ options += '<option value="' + this.id + '">' + this.label + '</option>';
+ });
- $("#id_valeur_point_min").html(options);
- $("#id_valeur_point_max").html(options);
+ $("#id_valeur_point_min").html(options);
+ $("#id_valeur_point_max").html(options);
+ alert("Les valeurs de point on été ajustées en fonction de cette implantation.");
});
}
/* La fonctionnalité de présélection, est activé uniquement si aucune implantation n'a déjà été
sélectionnée.
- Lorsque l'implantation est changée, on ajuste les valeurs de points en fonction de cette
- sélection, UNIQUEMENT si aucune valeur n'est encore définie. */
+ Lorsque l'implantation est changée, on ajuste les valeurs de points en fonction de cette sélection */
var implantation_id = $("#id_implantation").val();
- if (implantation_id == "") {
-
- $("#id_implantation").change(function() {
- var implantation_id = this.value;
- charger_valeurs_point(implantation_id);
- });
- }
+ $("#id_implantation").change(function() {
+ var implantation_id = this.value;
+ charger_valeurs_point(implantation_id);
+ });
$('#id_valeur_point_min, #id_valeur_point_max').change(function(e) {