4 Replies Latest reply: Jan 6, 2016 9:20 AM by Kevin McGovern RSS

    List of Sheets in Extension Properties

    Kevin McGovern

      Hi all,

       

      For my extension I am using the qlik.currApp().getAppObjectList( 'sheet',callback) method to get a list of all the sheets in a document and update the DOM.  However, I want to also include a list of all sheets in the document in my properties.  Because getAppObjectList only accepts a callback for the sheet list I can't update my properties synchronously.  Is there an alternate method to retrieve the list of sheets via another method that allows me to get the list synchronously?  Alternatively, is there a way to update the extension properties asynchronously?

       

      define(['qlik'], function (qlik) {

          //create var that contains api method of current object

          var apiMethod = qlik.currApp();

          //declare value var to be used inside callback

          var sheetPropVar ='';

          //call getAppObjectList, specifying an argument and use callback to access contents of method

          apiMethod.getAppObjectList('sheet',function (reply) {

              //loop through each value inside callback

              $.each(reply.qAppObjectList.qItems, function (key, value) {

                  //add values to variable for each instance of method

                  sheetPropVar += 'the key is '+key+' and the value is'+value;

              });

          });

          //return some values as well as the value set above for the overall define method

          return {

              type: "items",

              component: "accordion",

              items: {

                  appearance: {

                      uses: "settings"

                  },

                  configuration : {

                          component: "expandable-items",

                          label: "Sheet Configuration",

                          items: sheetPropVar //sheetPropVar is '' since it is set insde a callback function

                  }

              }

          }

      });

       

      Thank you in advance for your help.

       

      Side note: I am not using Angular for my extension right now.