Reputation: 109
Is there a way to preserve the contents of a tabbed component when toggling between them? I found @PreserveOnRefresh but that only seems to work when refreshing the browser.
Upvotes: 2
Views: 116
Reputation: 495
Assuming you mean navigating between Routes/views rendered as tabs, I think what you're looking for is the @SpringComponent and @UIScope annotations. Add these to the relevant classes to preserve any input fields and outputs when toggling. Note that you'll still need @PreserveOnRefresh if you want to retain those fields when refreshing the page itself.
See: Vaadin Component as Spring bean for a breakdown of the specific functions the two annotations serve.
Upvotes: 4