Browser History with ExtJS MVC

北慕城南 提交于 2019-12-13 06:23:58

问题


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?


回答1:


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/

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

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



来源:https://stackoverflow.com/questions/23572775/browser-history-with-extjs-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!