Created
June 24, 2014 09:06
-
-
Save starquake/4e37fea12e7ce5851eac to your computer and use it in GitHub Desktop.
(TestApp1/app/view/Main.js) Problems with Sencha Touch and Sencha CMD 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('TestApp1.view.Main', { | |
extend: 'Ext.tab.Panel', | |
xtype: 'main', | |
requires: [ | |
'Ext.data.TreeStore', | |
'Ext.data.JsonP', | |
'Ext.data.proxy.JsonP', | |
'Ext.dataview.NestedList', | |
'Ext.Panel', | |
'Ext.form.Panel', | |
'Ext.form.FieldSet', | |
'Ext.field.Text', | |
'Ext.field.Email', | |
'Ext.field.TextArea' | |
], | |
initialize: function () { | |
Ext.create('Ext.data.TreeStore', { | |
storeId: 'TreeStore', | |
fields: ['title', 'link', 'author', 'contentSnippet', 'content', { | |
name: 'leaf', | |
defaultValue: true | |
}], | |
root: { | |
leaf: false | |
}, | |
proxy: { | |
type: 'jsonp', | |
url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog', | |
reader: { | |
type: 'json', | |
rootProperty: 'responseData.feed.entries' | |
} | |
} | |
}); | |
Ext.create("Ext.tab.Panel", { | |
fullscreen: true, | |
tabBarPosition: 'bottom', | |
items: [ | |
{ | |
title: 'Home', | |
iconCls: 'home', | |
cls: 'home', | |
html: [ | |
'<img width="65%" src="http://staging.sencha.com/img/sencha.png" />', | |
'<h1>Welcome to Sencha Touch</h1>', | |
"<p>We're creating the Getting Started app, which demonstrates how ", | |
"to use tabs, lists, and forms to create a simple app.</p>", | |
'<h2>Sencha Touch</h2>' | |
].join("") | |
}, | |
{ | |
xtype: 'nestedlist', | |
title: 'Blog', | |
iconCls: 'star', | |
displayField: 'title', | |
store: 'TreeStore', | |
detailCard: { | |
xtype: 'panel', | |
scrollable: true, | |
styleHtmlContent: true | |
}, | |
listeners: { | |
itemtap: function (nestedList, list, index, element, post) { | |
this.getDetailCard().setHtml(post.get('content')); | |
} | |
} | |
}, | |
// this is the new item | |
{ | |
title: 'Contact', | |
iconCls: 'user', | |
xtype: 'formpanel', | |
url: 'contact.php', | |
layout: 'vbox', | |
items: [ | |
{ | |
xtype: 'fieldset', | |
title: 'Contact Us', | |
instructions: '(email address is optional)', | |
height: 285, | |
items: [ | |
{ | |
xtype: 'textfield', | |
label: 'Name' | |
}, | |
{ | |
xtype: 'emailfield', | |
label: 'Email' | |
}, | |
{ | |
xtype: 'textareafield', | |
label: 'Message' | |
} | |
] | |
}, | |
{ | |
xtype: 'button', | |
text: 'Send', | |
ui: 'confirm', | |
handler: function () { | |
this.up('formpanel').submit(); | |
} | |
} | |
] | |
} | |
] | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment