Permalink
Browse files

Create a single detail panel, and reuse it.

  • Loading branch information...
1 parent 4eb245c commit a3286fa736dd8fb1b34ff14bbd7e71f52ea34cad @nelstrom committed Mar 1, 2011
Showing with 9 additions and 8 deletions.
  1. +3 −8 public/app/views/Viewport.js
  2. +5 −0 public/app/views/detail_panel.js
  3. +1 −0 views/index.erb
@@ -5,15 +5,10 @@ NestedListDemo.views.Viewport = Ext.extend(Ext.NestedList, {
store: NestedListDemo.music_store,
getDetailCard: function(item, parent) {
var itemData = item.attributes.record.data,
- parentData = parent.attributes.record.data,
- detailCard = new Ext.Panel({
- scroll: 'vertical',
- styleHtmlContent: true,
- tpl: ["<h2>{text}</h2>","{info}"]
- });
- detailCard.update(itemData);
+ parentData = parent.attributes.record.data;
+ NestedListDemo.views.detailCard.update(itemData);
this.backButton.setText(parentData.text);
- return detailCard;
+ return NestedListDemo.views.detailCard;
},
getItemTextTpl: function() {
var tplConstructor = '{text}' +
@@ -0,0 +1,5 @@
+NestedListDemo.views.detailCard = new Ext.Panel({
+ scroll: 'vertical',
+ styleHtmlContent: true,
+ tpl: ["<h2>{text}</h2>","{info}"]
+});
View
@@ -10,6 +10,7 @@
<script src="app/app.js" type="text/javascript"></script>
<script src="app/models/list_item.js" type="text/javascript"></script>
<script src="app/stores/music_store.js" type="text/javascript"></script>
+ <script src="app/views/detail_panel.js" type="text/javascript"></script>
<script src="app/views/Viewport.js" type="text/javascript"></script>
</head>

0 comments on commit a3286fa

Please sign in to comment.