View Full Version : One page application, how many views ?

30 May 2014, 9:12 AM

I'm fairly new to ExtJS's MVC concept and I plan to do a one page application. A navigation menu's buttons will simply hide and show windows with whatever items they'll have.

From there, I am a bit confused as how many views I will need.

The view "Viewport.js" seems to be used to declare all views and host methods that create them. In this example (http://firmamento.org/blog/2012/12/20/how-to-build-a-large-single-page-javascript-application-using-extjs/), "createSearchBar" for create the view that holds the search bar.

But this example shows all views at once all rendered into the viewport.

How one would handle showing and hiding views to give the illusion of browsing from page to page and what needs to be done in MVC for this to be done as per best practices ?

30 May 2014, 12:08 PM
This sort of depends on what you want to happen. You can created each of your views on a tabpanel and select the tab, or use a card layout to display the views independently.

30 May 2014, 12:18 PM
I'd like a menu to the left (perhaps a panel's left bar) that would decide what would be shown in the center region. I just looked at the card layout and I guess the navigation menu to the left could simply be setting the 'activeItem' property of the card panel.