-
Book Overview & Buying
-
Table Of Contents
Ext JS Application Development Blueprints
By :
We have our design, so let's step a little closer and examine the parts of the application where a little more detail may be required. For example, we have a controller method called onAddClick that will be handling the process of adding a new record, but what will this actually entail and are there any pain points hidden within? Here's what needs to happen when this handler is done with its job:
Ask the user for a name for the new page
Create a new blank record with default values and the page name
Add the page as a child node of the current page
Load the record in the detail panel
Show the new record in the tree
That's a lot for a single controller action. Let's look at how we might code it to see whether we're trying to do too much. We'll write some pseudocode (fake code) to drill down into some detail:
newPageName = promptUser 'Please enter a page name'
newPageModel = new Page {
text = newPagename
}
pageTree.addAndSelect newPageModelThere's no JavaScript here...
Change the font size
Change margin width
Change background colour