Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Through macros you can invoke ActivateSheetById to switch sheets but how do invoke this or similar function to switch sheets in a object extension?
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)
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.
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)
Thanks Alexander,
I was afraid that was the answer about the Automation APIs from JS API but I was hoping I was wrong.
Also thank you for your ideas. I will look into them. I had got it working by setting a QV variable through the JS API which had a trigger on it so whenever the variable changed it would change the sheet to the value of the variable.
Thank you!