Skip to content
Browse files

Set title of detail panel: First M. Last

  • Loading branch information...
1 parent 627d732 commit 8f2ee35eb3ecff290f244566231126604772c0ac @nelstrom committed
Showing with 11 additions and 0 deletions.
  1. +1 −0 app/controller/Main.js
  2. +10 −0 app/model/President.js
View
1 app/controller/Main.js
@@ -15,6 +15,7 @@ Ext.define('Sencha.controller.Main', {
showDetail: function(list, record) {
this.getMain().push({
xtype: 'presidentdetail',
+ title: record.fullName(),
data: record.data
})
}
View
10 app/model/President.js
@@ -2,5 +2,15 @@ Ext.define('Sencha.model.President', {
extend: 'Ext.data.Model',
config: {
fields: ['firstName', 'middleInitial', 'lastName']
+ },
+
+ fullName: function() {
+ var d = this.data,
+ names = [
+ d.firstName,
+ (!d.middleInitial ? "" : d.middleInitial + "."),
+ d.lastName
+ ];
+ return names.join(" ");
}
});

0 comments on commit 8f2ee35

Please sign in to comment.
Something went wrong with that request. Please try again.