setCurrentView on containers does not seem to exist

Hi!
The documentation says that there should be the functions

container1.setCurrentView("View 1");
container1.setCurrentViewIndex(0);

should exist on containers with multiple views. However, I have containers with multiple views and these functions do not seem to exist on them.

How to reproduce:

  • add component Container
  • add multiple views
  • try to call setCurrentViewIndex(0)

Behaviour:
function is not found

Expected behaviour:
Setting current view index

I do see currentViewIndex and currentViewKey properties, but setting those does not do anything.

This works for me:

container1.setCurrentViewIndex(1)

Hey @Lychee ,

This function also works in my app! Look:



check your Retool version to ensure compatibility.

Additionally, Retool components sometimes take time to load, which may cause functions to be temporarily unavailable. If you were testing in a browser with cached JavaScript, Retool might not have properly loaded the functions.

Try a hard refresh (Ctrl + Shift + R)

5 Likes

Hey @Lychee - if you're running an older self-hosted instance, it's possible that this particular method may not be available. If you're on the Retool cloud, though, you should definitely see that option.

Let us know if you are still having trouble!

I could be way off base, but does the {{ and }} in the screenshot mean this is in a transformer context of sorts and can't call functions that set things?

2 Likes

I think you hit the nail on the head, @khill-fbmc! Good catch.

1 Like

AH I was not aware of read-only transformer contexts - makes sense, thank you @khill-fbmc!

1 Like