How to create a multi-page application using ExtJs 4

I have to create an ExtJs4 application that should have a main menu, and each menu item should open a new page with a different URL, so if the user copies the URL and pastes to another browser tab, the application should open this menu item.

I want to use the ExtJ recommended MVC architecture, but I do not know how I can use it with multiple pages / URLs. All of their examples use one page.

One option is to reload the page every time the user clicks on a particular menu, so each URL / element / page will be a separate ExtJS application with its MVC. But I think that this approach has its drawbacks, since the page will reload every time, and this is not good for performance. It also makes it difficult to reuse components (generic models, stores, and views for different pages).

So, I would like to have one application for all pages, but I do not know if there is any solution to have different URLs for different views (in my case: for different menu items).

Or is there a different approach for such applications?

+3
source share
1 answer

, Viewport Region Region Container.

.

(Component), .

- URL. .

, URL-, . , ExtJS, . HTML5 pushState.

, URL.

Microsoft Prism, WPF Silverlight, , ExtJS.

http://msdn.microsoft.com/en-us/library/gg430881(v=pandp.40).aspx

:

  • call app.requestNavigate('contacts/5'); .

  • , :

navigationContext = {  
  fragment: 'contacts/5',  
  xtype: 'contacts-form',  
  parameters:{  
    id: 5  
  }  
}

: :

  • ( ). , confirmNavigationRequest(callback). .

  • callback(true), . , , ""

END OPTIONAL

  • - widget navigationContext.xtype, , setActiveItem(widget). , .

history.pushState(null, null, navigationContext.fragment)

"navigatedto" , , .

:

  • , . keepAlive true, , .

  • , (, , 5, )

+2

All Articles