如何处理 GXT MVC 中的刷新机制

发布于 2024-08-15 06:38:09 字数 84 浏览 4 评论 0原文

你好, 当用户使用 MVC 模式在 GXT 中刷新浏览器或 f5 时,如何保留应用程序的当前状态以及所有打开的选项卡和加载的网格? 问候, 斯里尼

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一身软味 2024-08-22 06:38:09

一种方法是设置浏览器 cookie,以便稍后可以恢复浏览器状态。

  1. 构建网格/选项卡面板
  2. 使用当前分页设置或打开的选项卡设置 cookie
  3. 当分页设置更改或打开/关闭选项卡时,更新 cookie

现在您正在设置 cookie,请更新步骤 1 以便构建网格/tab 面板使用您从用户的 cookie 中读取的设置。当然,如果未设置 cookie,请使用默认设置(网格从第 1 页开始;选项卡面板中不打开任何选项卡)。

如果您在 MVC 模式中使用相当严格的关注点分离,则 cookie 的设置和更新应该发生在控制器层。 Cookie 本身是模型数据的另一个来源,视图(UI 小部件)不需要了解选项卡为何打开或网格为何从第 3 页开始。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文