Permalink
Browse files

Register xtypes for aboutcard and bookmarkcard.

Previously, the morecard nestedlist had to instantiate an instance of
these classes, which meant that the store holding a reference to them
had to be loaded after the views. Now, the load order doesn't matter.
Happy days.
  • Loading branch information...
1 parent 0d16b80 commit 771a0666a24a3dc40c62f7389f86e3e02020acf8 @nelstrom committed Mar 31, 2011
@@ -1,16 +1,14 @@
-// Note: This file must be loaded after the files:
-// bookmarkcard.js and aboutcard.js
ToolbarDemo.morestore = new Ext.data.TreeStore({
model: 'ListItem',
root: {
items: [{
text: 'About',
- card: ToolbarDemo.views.Aboutcard,
+ card: {xtype: 'aboutcard'},
leaf: true
},
{
text: 'Bookmarks',
- card: ToolbarDemo.views.Bookmarkcard,
+ card: {xtype: 'bookmarkcard'},
leaf: true
}],
},
@@ -3,3 +3,5 @@ ToolbarDemo.views.Aboutcard = Ext.extend(Ext.Panel, {
styleHtmlContent: true,
html: 'Made from coffee'
});
+
+Ext.reg('aboutcard', ToolbarDemo.views.Aboutcard);
@@ -3,3 +3,5 @@ ToolbarDemo.views.Bookmarkcard = Ext.extend(Ext.Panel, {
styleHtmlContent: true,
html: 'Your bookmarks here'
});
+
+Ext.reg('bookmarkcard', ToolbarDemo.views.Bookmarkcard);
@@ -5,7 +5,7 @@ ToolbarDemo.views.Morecard = Ext.extend(Ext.NestedList, {
cardSwitchAnimation: 'slide',
getDetailCard: function(item, parent) {
var itemData = item.attributes.record.data;
- return new itemData.card;
+ return itemData.card;
}
});
View
@@ -9,13 +9,13 @@
<!-- app, models, stores, views, controllers [in that order!] -->
<script src="app/app.js" type="text/javascript"></script>
<script src="app/models/list_item.js" type="text/javascript"></script>
+ <script src="app/stores/morestore.js" type="text/javascript"></script>
<script src="app/views/homecard.js" type="text/javascript"></script>
<script src="app/views/searchcard.js" type="text/javascript"></script>
<script src="app/views/actioncard.js" type="text/javascript"></script>
<script src="app/views/settingscard.js" type="text/javascript"></script>
<script src="app/views/aboutcard.js" type="text/javascript"></script>
<script src="app/views/bookmarkcard.js" type="text/javascript"></script>
- <script src="app/stores/morestore.js" type="text/javascript"></script>
<script src="app/views/morecard.js" type="text/javascript"></script>
<script src="app/views/Viewport.js" type="text/javascript"></script>

0 comments on commit 771a066

Please sign in to comment.