ExtJS:store、pagingToolbar 和 PHP 会话过期
假设您正在访问一个带有 ExtJS 网格和分页工具栏的页面。假设您在此页面上停留了一段时间,在此期间您的 PHP 会话到期。当您在网格上点击“下一页”或“重新加载”时,对服务器的调用将失败,因为它将回答一些内容,通知您不允许获取信息(因为您的会话已过期)。
如何在 gridPanel 中处理它以避免卡住?我希望这已经足够清楚了..
再见!
Let's imagine you are on a page with an ExtJS grid with a pagingToolbar. Let's imagine that you remain on this page for a while and that during this time your PHP session expires. When you hit "Next page" or "reload" on the grid, the call to the server will fail since it will answer with something informing you that you are not allowed to get the information (since your session has expired).
How can you handle that in the gridPanel in order to avoid it to get stuck? I hope this was clear enough..
Bye!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要某种心跳机制,这意味着您必须定期向服务器发送 AJAX 调用以保持 PHP 会话处于活动状态。如果您使用
Ext.direct
,您可以简单地使用Ext.direct.PollingProvider
这是迄今为止实现此类心跳的最方便的方法。如果您不使用Ext.direct
,您可以使用Ext.TaskMgr
或Ext.util.TaskRunner
定期调用一个函数,您可以在其中简单地发出 AJAX 请求。实施细节留给OP。
You'll need some sort of heartbeat mechanism, which means that you must periodically send an AJAX call to your server to keep the PHP session alive. If you're using
Ext.direct
you can simply make use of theExt.direct.PollingProvider
which is by far the most convenient way to implement such a heartbeat. If you're not usingExt.direct
you can useExt.TaskMgr
orExt.util.TaskRunner
to call a function periodically in which you can simply issue an AJAX request.The implementation details are left to the OP.