Permalink
Browse files

On list item disclosure, show a detail panel.

  • Loading branch information...
1 parent 4f1267a commit 18e52f899338a330452fcd87ec8ce567ce76d3d5 @nelstrom nelstrom committed Feb 18, 2012
Showing with 38 additions and 9 deletions.
  1. +2 −2 app.js
  2. +14 −2 app/controller/Main.js
  3. +9 −4 app/view/Main.js
  4. +11 −0 app/view/PresidentDetail.js
  5. +2 −1 app/view/PresidentList.js
View
4 app.js
@@ -2,13 +2,13 @@ Ext.application({
name: 'Sencha',
controllers: ['Main'],
- views: ['PresidentList'],
+ views: ['Main'],
stores: ['Presidents'],
models: ['President'],
launch: function() {
Ext.Viewport.add({
- xtype: 'presidentlist'
+ xtype: 'mainpanel'
});
}
});
View
@@ -2,8 +2,20 @@ Ext.define('Sencha.controller.Main', {
extend: 'Ext.app.Controller',
config: {
- refs: {},
- control: {}
+ refs: {
+ main: 'mainpanel'
+ },
+ control: {
+ 'presidentlist': {
+ disclose: 'showDetail'
+ }
+ }
+ },
+
+ showDetail: function() {
+ this.getMain().push({
+ xtype: 'presidentdetail'
+ })
}
});
View
@@ -1,9 +1,14 @@
Ext.define('Sencha.view.Main', {
- extend: 'Ext.Panel',
+ extend: 'Ext.navigation.View',
+ xtype: 'mainpanel',
+ requires: [
+ 'Sencha.view.PresidentList',
+ 'Sencha.view.PresidentDetail'
+ ],
config: {
- layout: 'fit',
- styleHtmlContent: true,
- scrollable: 'vertical'
+ items: [{
+ xtype: 'presidentlist'
+ }]
}
});
@@ -0,0 +1,11 @@
+Ext.define('Sencha.view.PresidentDetail', {
+ extend: 'Ext.Panel',
+ xtype: 'presidentdetail',
+
+ config: {
+ title: 'Details',
+ styleHtmlContent: true,
+ scrollable: 'vertical',
+ html: 'Hello, World!'
+ }
+});
@@ -4,9 +4,10 @@ Ext.define('Sencha.view.PresidentList', {
requires: ['Sencha.store.Presidents'],
config: {
+ title: 'American Presidents',
grouped: true,
- indexBar: true,
itemTpl: '{firstName} {lastName}',
store: 'Presidents',
+ onItemDisclosure: true
}
});

0 comments on commit 18e52f8

Please sign in to comment.