2 Replies Latest reply on Jan 9, 2014 11:37 AM by Liphou

    [JS] dialogue

    Liphou Level 2


      Here is my problem, after the selection and display, I would deselect or reset the selection.

      thank you



      var mesCommades = ["Modification du Style", "Supprimer un format", "Utiliser les paramètres de la séléction"]; //ok
      var diaGeneral = new Window ("dialog", "Place documents", undefined, {closeButton: false});
              diaGeneral.alignChildren = "right";
              var mesCommandesGroupe = diaGeneral.add ("group");
                  mesCommandesGroupe.add ("statictext", undefined, "Commandes: ");
                    var list = mesCommandesGroupe.add ("dropdownlist", [0,0,20,20], mesCommades);
                                                  list.minimumSize.width = 20;
      list.onChange = function () {
          alert (list.selection.index);
          list.selection.index = null; // ré-initialisation de la selection
      diaGeneral.show ();





      Voici mon problème, après la sélection et l'affichage, je voudrais désélectionner ou réinitialiser la sélection



        • 1. Re: [JS] dialogue
          Peter Kahrel Adobe Community Professional & MVP



          I'm entirely at a loss what you want to do, but it's interesting to get it to work anyway. Two changes are needed. First, you can't set a list's selection's index to null: you need to set the list's selection to null. Second, setting the list's selection to null is a change to that list which is captured by list.onChange. Therefore, what you in effect do is set the selection to null and then immediately ask what the selection is. Here is what I think is the solution to your problem:


          list.onChange = function () {
              if (list.selection != null ) {
                  alert (list.selection.index);
              list.selection = null; // ré-initialisation de la selection


          • 2. Re: [JS] dialogue
            Liphou Level 2

            Super ... thank you very much Peter.

            Super ... merci beaucoup Peter.