A common ailment in AJAX applications is support for the back button, history, and bookmarks. The user selects an item in a list, expands a treelist, or switches to a different tab in a notebook, but when they navigate away and return, they're back where they were when the page first loaded. This can be highly disconcerting to the user, depending on how rich of a UI has been presented. Similarly, forwarding links to others or adding them to bookmarks yields surprising results.

The problem is that state is generated in the browser that is not retained on the server, so page navigations lose it. Jitsu's solution to this problem is first to clearly delineate between state that is data, and state that is view-specific, or view state . We then provide a system service for view state management that allows views to save and retrieve this significantly smaller state across page navigations.

In the example above, both the list control and the card deck provide built-in support for the back button. As you select items from one of the lists, or switch cards, you will notice the URL for the page changes. A hash suffix is added, which contains encoded state for the controls. Since this information is encoded in the URL for the page, you can bookmark it, or mail it to a friend. Also, try pressing back, and you will see that the controls update themselves appropriately. The developer is blissfully unaware of the machinery at work. [TODO need to expose properties that turn this on selectively - controls will not always want to retain viewstate, in particular when their underlying state was bound. We may want to do this automatically when we see bindings on the view state properties]

You can even add view state support to your own controls. For more information on the api, see the documentation in the guide.

[TODO need a cursor object that manages view state for queries]