12 Dec 2007 4:09 AM #1
Application architecture like API Viewer (2.0)
Its been awhile since my last post on these forums. I'm raising a question to which i haven't found an answer on the forums yet.
Looking on the API viewer for the ext 2.0 i would like to know if there is a way to make the a web application using Ext to behave like the API viewer.
When I say "behave like the API viewer", i mean no use of iframes in the center region and the content of the tabs to be fetched using Ajax.
Inside the tabs I would like to have complex functionalities, like grids, forms, other (inner) layouts, all with their particular business logic. In a way something similar with the API viewer, or yahoo mail beta but a but more complex.
What would be the best practice to implement something like this?
- no iframes for the tabs
- tab content is dynamic, i.e. there could be grids forms, and distinct business logic in each tab
- response to ajax calls to contain raw HTML and script, then script to be evaluated and to work with the new added raw html
12 Dec 2007 3:29 PM #2
This is what I do.
I have a tree on the left region to be used as a menu. The tree is built based on a JSON object. Each node has some configuration info to be used to decide what to do when the user clicks it (actually is a key to index a configuration structure). The normal behaviour in response to a tree click is adding a tab to the center region and loading an HTML fragment into it. The fragment is always like this:
<style>/* optional style */</style> <div class="fragment" id="fragment-whatever"> <!-- some stuff here --> </div>
One thing you may want to consider is a naming scheme for your tag ids and CSS selectors so that different fragment do not interfere with each other. Sometime I get a reference to a DOM element in the fragment selecting by class name, but usually I assign to every fragment a unique prefix that I use for all the ids of that fragment. This however has to be tweaked a little if you have multiple copies of the same fragment loaded in different tabs at the same time.
Anyway the Ext 2.0 API application, has already much of this code.
13 Dec 2007 1:22 AM #4
13 Dec 2007 2:47 AM #5
13 Dec 2007 2:40 AM #6
Anyway, I have users with a 56K modem connection that do not complain. I have no idea how it is possible. Maybe nowadays all intenet contents is so bloated that they are accustomed to be waiting.
13 Dec 2007 3:10 AM #7
Of course my users are regular people, not some web dev freaks who clean their cache every 5 minutes
13 Dec 2007 5:50 AM #8How could this slow down the dev process (as in Development Process)? Do you mean slowing down the loading of the pages?
How do you load the js on demand?
You can see my load js on demand code here(extracted from my project):
13 Dec 2007 1:00 AM #9
Depending on the number of links in your left nav, couldn't your main page become quite large by maintaining each link's content in DIVs on the main page? What about autoLoad'ing a separate HTML file into the content panel?
13 Dec 2007 2:31 AM #10