Keeping state of a Page and its components between Page refreshes or Posts

Hi I have Tab like design for my page which is created using UL and Div and loading the different partial components or hbs files when clicked.

Now the problem is when I post some data to Server then when the whole page refreshes or loads, then the selected tab is defaulting to the first Tab that I have, I want to save the tab that’s selected before I posted to server then when page data is refreshed I want to read from the state that’s saved and load that particular tab, can somebody please advice me. I have code but it’s huge, but if you insist to post here I can but need to delete a lot of it as its too huge.

Any suggestion please helps thank you so much

Hi, the first thing that comes to my mind is trying to create proper data model on back-end site, that contains info about current tab e.g. kind of flag.

or depending on the data and how it’s fetched you could use a route for your tabs so the active tab becomes part of the URL and therefore persists on refresh

OK I am doing it now but it seems like it has got performance hit, is there nothing like ViewState in Ember or JavaScript Technologies?

Not built-in. IIRC ViewState requires server support and Ember is server agnostic so you’d have to write your own or use an addon for something like that.