tags:

views:

548

answers:

1

HI, How to retain the current state of the application with all the opened tabs and loaded grid when user does browser refresh or f5 in GXT using MVC pattern? Regards, Srini

A: 

One approach is to set browser cookies so that browser state can be restored at a later point.

  1. Construct the grid/tab panel
  2. Set a cookie with the current paging settings or open tabs
  3. When the paging settings change or when tabs are opened/closed, update the cookie

Now that you're setting cookies, update step 1 so that you construct the grid/tab panel using settings you read from the user's cookies. Of course, if no cookies are set, use the default settings (grids start on page 1; no tabs open in the tab panel).

If you are using a fairly strict separation of concerns in your MVC pattern, the setting and updating of cookies should occur in the controller layer. The cookies themselves are another source of model data, and the view (UI widgets) need not understand why tabs are open or why the grid starts on page 3.

Wesley