Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a title to the detail panel.

Construct a Toolbar, rather than assiging as config object.

By calling the constructor explicitly, it can be assigned to a variable,
which makes it easier to reference, rather than having to go through the
parent object.dockedItems.first().
  • Loading branch information...
commit dbe2cb2d919ce248d523299c812fc762698efa2b 1 parent eba804c
@nelstrom authored
Showing with 14 additions and 11 deletions.
  1. +14 −11 public/javascripts/index.js
View
25 public/javascripts/index.js
@@ -3,19 +3,20 @@ ListDemo = new Ext.Application({
launch: function() {
+ ListDemo.detailToolbar = new Ext.Toolbar({
+ items: [{
+ text: 'back',
+ ui: 'back',
+ handler: function() {
+ ListDemo.Viewport.setActiveItem('indexlist');
+ }
+ }]
+ });
+
ListDemo.detailPanel = new Ext.Panel({
id: 'detailpanel',
tpl: 'Hello, {firstName}!',
- dockedItems: [{
- xtype: 'toolbar',
- items: [{
- text: 'back',
- ui: 'back',
- handler: function() {
- ListDemo.Viewport.setActiveItem('indexlist');
- }
- }]
- }]
+ dockedItems: [ListDemo.detailToolbar]
});
ListDemo.listPanel = new Ext.List({
@@ -23,7 +24,9 @@ ListDemo = new Ext.Application({
store: ListDemo.ListStore,
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
grouped: true,
- onItemDisclosure: function(record, btn, index) {
+ onItemDisclosure: function(record) {
+ var name = record.data.firstName + " " + record.data.lastName;
+ ListDemo.detailToolbar.setTitle(name);
ListDemo.detailPanel.update(record.data);
ListDemo.Viewport.setActiveItem('detailpanel');
}
Please sign in to comment.
Something went wrong with that request. Please try again.