4 Replies Latest reply: Nov 4, 2013 7:25 AM by Mike Smith RSS

    How to activate a sheet in an object extension?

      Through macros you can invoke ActivateSheetById to switch sheets but how do invoke this or similar function to switch sheets in a object extension?

        • Re: How to activate a sheet in an object extension?
          Sokkorn Cheav

          Hi Mike,

           

          You may refer to this extension.

           

          Regards,

          Sokkorn

            • Re: How to activate a sheet in an object extension?

              Thank you but this is a document extension that uses SetTabrowPaint. I'm not sure if or how you would translate this into an object extension. While I'm currently trying to invoke something like the ActivateSheetById method, I'd be curious to know if you could (and how) invoke any of the QV Automation Interface methods within extensions (currently an object extension).  Thanks again.

                • Re: How to activate a sheet in an object extension?
                  Alexander Karlsson

                  Hey Mike,

                   

                  You can't invoke any methods from the Automation API from the JS API.

                   

                  On to your original question,

                  There is a few different ways to approach this, I would opt to use a simple solution and just supply a sheet parameter to the url.

                   

                  So invoking something like this from within your extension will refresh the page and direct the user to the correct sheet.

                   

                  var sheetId = 'SH01'

                  window.location = window.location.href + '&sheet=' + sheetId;

                   

                  You want to build some logic around handling already existing parameters in the url though.

                   

                  You could also do something like this which would be running the same internal function as standard QV.

                  It's not part of the official API so if we decided to re-build the way we handle tab changes it would break.

                   

                  Qv.GetCurrentDocument().binder.Set("Document.TabRow.Document\\SH27", "action", "", true)