1 Reply Latest reply on Mar 11, 2013 12:08 PM by Geoffroy Schneck

    selection problem

    KevinLiujw

      when I use xtype "selection",type "select" options use *json.jsp, but edit content cannot be displayed select content at the first time.

      second time edit content. can display this select content. 

       

      please ask what reason ?

        • 1. Re: selection problem
          Geoffroy Schneck Level 2

          Can you be a little more specific / clearer on  how you try to achieve this ?

           

          One correct way to display the result of a json request in a Select List (here I want to display the running instances) : 

           

          - On the widget node of xtype selection : set the 'optionsProvider' property to a function name (CQ.myapp.utils.getWFInstances)

          - Define this function like this :

           

          getWFInstances: function() {

                      var sampleData = [], results = CQ.Util.eval(CQ.HTTP.get('/libs/cq/workflow/content/console/instances.json')).workflows;

                      for (var i = 0, len = results.length; i < len; i++) {

                          var result = results[i];

                          sampleData.push({ value: result.model, text: result.model });

                      }

                      return sampleData;

                  },

           

          Resource hit by the request is /libs/cq/workflow/components/console/instances/json.jsp .

           

          It runs fine for me. Does this help for your use case ?