0 Replies Latest reply: Jan 12, 2017 7:09 PM by Yassin Saudie RSS

    Programatically get the current sheet in the app a mashup?

    Yassin Saudie

      Hi Everyone,

       

      I was just wondering whether or not anyone has been able to get the current sheet or has a method of getting the current sheet of an app and to have it change dynamically to the current sheet when you click the next sheet?

       

      I know about the qlik navigation API's getCurrentSheetId() method, however this only works if the extension is on a specified page, i want to be able to run a function through a mashup in the background and get each sheet id as you click next sheet.

       

      I have the below code used in my mashup:

       

      function getSheet(appid, config) {

        require( ["js/qlik"], function (qlik) {

        var app = qlik.openApp(appid, config);

        var sheetID;

        var getSelections = app.getList("sheet", function(reply){

        sheetID = "";

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

        sheetID +=  value.qInfo.qId + " ";

        console.log(sheetID);

        });

        });

      })};

       

      This gets the sheet ID, however it retrieves the entire sheet list within the app and is not dynamic, e.g. when you click next, the same sheet list is shown under sheetID variable, does anyone have another method to get the current sheet selected and pass it through to a variable dynamically?

       

      Thanks!