Permalink
Browse files

Customize the morecard with a nested list.

  • Loading branch information...
1 parent 4bb71d4 commit 11982c63451af110a74d832b98ff52bae7792cc3 @nelstrom nelstrom committed Jul 29, 2011
@@ -0,0 +1,6 @@
+Ext.regModel('ListItem', {
+ fields: [
+ {name: 'text', type: 'string'},
+ {name: 'card'}
+ ]
+});
@@ -0,0 +1,22 @@
+ToolbarDemo.morestore = new Ext.data.TreeStore({
+ model: 'ListItem',
+ root: {
+ items: [{
+ text: 'About',
+ card: {xtype: 'aboutcard'},
+ leaf: true
+ },
+ {
+ text: 'Bookmarks',
+ card: {xtype: 'bookmarkcard'},
+ leaf: true
+ }],
+ },
+ proxy: {
+ type: 'ajax',
+ reader: {
+ type: 'tree',
+ root: 'items'
+ }
+ }
+});
@@ -0,0 +1,7 @@
+ToolbarDemo.views.Aboutcard = Ext.extend(Ext.Panel, {
+ id: 'aboutcard',
+ styleHtmlContent: true,
+ html: 'Made from coffee'
+});
+
+Ext.reg('aboutcard', ToolbarDemo.views.Aboutcard);
@@ -0,0 +1,7 @@
+ToolbarDemo.views.Bookmarkcard = Ext.extend(Ext.Panel, {
+ id: 'bookmarkcard',
+ styleHtmlContent: true,
+ html: 'Your bookmarks here'
+});
+
+Ext.reg('bookmarkcard', ToolbarDemo.views.Bookmarkcard);
@@ -1,6 +1,12 @@
-ToolbarDemo.views.Morecard = Ext.extend(Ext.Panel, {
- title: "more",
- iconCls: "more"
+ToolbarDemo.views.Morecard = Ext.extend(Ext.NestedList, {
+ title: "More",
+ iconCls: "more",
+ store: ToolbarDemo.morestore,
+ cardSwitchAnimation: 'slide',
+ getDetailCard: function(item, parent) {
+ var itemData = item.attributes.record.data;
+ return itemData.card;
+ }
});
Ext.reg('morecard', ToolbarDemo.views.Morecard);
View
@@ -8,10 +8,14 @@
<script src="http://cdn.sencha.io/touch/1.1.0/sencha-touch.js" type="text/javascript"></script>
<!-- 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/views/morecard.js" type="text/javascript"></script>
<script src="app/views/Viewport.js" type="text/javascript"></script>

0 comments on commit 11982c6

Please sign in to comment.