¹ Kitchen Sink, used in Software development to denote a permanent, ever growing test and demo environment which showcases all the functionalities of a software product en.wikipedia.org
² blame MS
sudo apt-get install nodejs npm nodejs-legacy
sencha -sdk <ścieżka_do_sdk_senchy> generate app <nazwa_aplikacji> <katalog_aplikacji>
sencha fs web -p 8888 start -map <path/to/your/application/folder>
app/view/Main.js
w elemencie html
tak aby aplikacja wyświetlała 'Hello World
''Get Started
' i zamiast niej wstaw kartę 'News
cordova
i phonegap
sa zainstalowane: sudo npm install -g cordova
sencha cordova init re.geist.sencha.hello HelloWorld
app.json
i zmodyfikuj poniższy fragment, tak aby możliwe było zbudowanie natywnej aplikacji tylko dla Androida:"builds": { "web": {"default": true}, "native": { "packager": "cordova", "cordova" : { "config": { // Uncomment the line below and add the platforms you wish to build for //"platforms": "ios android", "id": "re.geist.sencha.hello", "name": "HelloWorld" } } } },
sencha build app <nazwa-build-z-app.json>
nestedList
do zakładki News
items [ ... { title: 'News', iconCls: 'info', xtype: 'nestedlist', title: 'News', }
NewsStore
do katalogu /app/store: Ext.define('HelloWorld.store.NewsStore', { extend: 'Ext.data.TreeStore', requires: ['Ext.data.proxy.JsonP'], id: 'NewsStore', config:{ autoLoad: true, fields: ['author', 'title', 'description', 'url', { name: 'leaf', defaultValue: true }], root: { leaf: false }, data: [ {author: 'Szymon Bobek',title:'Wielkie dzieło',description:'Blabla bla blabla blabla',url:'geist.re'}, {author: 'Krzysztof Kluza',title:'Wiekopomne dzieło',description:'Blabla blabl blabalbal blabla',url:'geist.re'} ], } });
app.js
:... name: 'HelloWorld', requires: [ 'Ext.MessageBox' ], stores:[ 'HelloWorld.store.NewsStore' ], ...
HelloWorld.store.NewsStore
do requires
w Main.js
title: 'News', iconCls: 'info', xtype: 'nestedlist', store: 'NewsStore', title: 'News', displayField: 'title', detailCard: { xtype: 'panel', scrollable: true, styleHtmlContent: true }, listeners: { itemtap: function(nestedList, list, index, element, post) { this.getDetailCard().setHtml( [post.get('description'),"</b>See more: <a href=",post.get('url'),">Geist</a>"].join("")); }
Ext.define('HelloWorld.store.NewsStore', { extend: 'Ext.data.TreeStore', requires: ['Ext.data.proxy.Ajax'], id: 'NewsStore', config:{ autoLoad: true, fields: ['author', 'title', 'description', 'url', { name: 'leaf', defaultValue: true }], root: { leaf: false }, proxy: { type: 'ajax', url: 'https://newsapi.org/v1/articles?source=techcrunch&apiKey=abe648b1a17a46df9609bd7778ba7522', reader: { type: 'json', rootProperty: 'articles' } } } });
cordova plugin add cordova-plugin-whitelist
phonegap.username=user@domain phonegap.password=p@ssw0rd
UWAGA W pliku app.json
wygenerowanym przez senche pola nazywają sie phonegap.remote.user
i phonegap.remote.password
co jest mylace Ma być jak w przykładzie powyżej.