Switch to Preview tab via dialogApi.switchTab()?

Hello,

Quick question: Is it possible to programmatically switch to the preview tab via dialogApi.switchTab('preview') or similar?

best,
Owen

Hi @owenhoskins

Yes, the dialog.switchTab() method does the trick.

For example, the following code makes the widget open the “preview” tab initially. Actually, you’ll see an empty tab if no files uploaded.

var widget = uploadcare.Widget('[role=uploadcare-uploader]');
widget.onDialogOpen(function (dialog) {
  dialog.switchTab('preview');
});
1 Like

Thanks for the sanity check! I actually tested this but somehow typed showTab() :face_with_hand_over_mouth: