浏览器历史与ExtJS MVC [英] Browser History with ExtJS MVC

查看:109
本文介绍了浏览器历史与ExtJS MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找支持浏览器历史的ExtJs MVC的例子。他们在Sencha网站上的例子这里不是基于MVC的。

I am looking for an example of ExtJs MVC which supports browser history. The example they have on the Sencha site here is not MVC based.

另一个我发现这里使用动态加载的视图和控制器。我想象的解决方案是两种方法的结合。想知道有没有人可以参考一下现在的例子?

The other one I found here uses dynamically loaded views and controller. I imagine the solution is a combination of the 2 approaches. Wondering if anyone has a ready example that I can refer to?

推荐答案

我设法组合了一个例子,上面的2个链接。这是jsfiddle与ext js脚本: http://jsfiddle.net/chetanbaheti/zGXr6/3/

I managed to put together an example by combining the approaches from the 2 links above. Here is the jsfiddle with the ext js script: http://jsfiddle.net/chetanbaheti/zGXr6/3/

有2个视图(标签) - 具有相应历史记录的家庭和提供者

There are 2 views (tabs) - home and providers with corresponding history tokens

DemoApp.view.HomeTab
DemoApp.view.ProvidersTab

每个选项卡由其相应的控制器管理,负责创建视图的实例并注册历史记录。

Each tab is managed by its corresponding controller that's responsible for creating an instance of the view and registering a history token.

DemoApp.controller.HomeController
//and its history token
this.uiToken = 'MainTabPanel,HomeTab';

管理初始状态的工作由应用程序功能完成:

The job of managing initial ui state is done by the application functions:

initializeHistoryHandling
setUiState

在主视图控制器中,通过选择选项卡(由用户操作)更改历史记录的工作:

While the job of changing the history token on selecting tabs (by user action) is done by the main view controller:

DemoApp.controller.ViewportController:onTabpanelTabChange

这个很好地基于url管理ui状态,反之亦然。

This nicely manages the ui state based on the url and vice versa.

这篇关于浏览器历史与ExtJS MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆