Sencha Touch は初めてで、ボタンをクリックして項目を追加するリストを含むアプリ (Web アプリではなく、PhoneGap のネイティブ) を作成しようとしています。何日も探していましたが、役立つ解決策が見つかりません。
ハードコードされた値を自分のコードに入れる必要がないコードを変更するにはどうすればよいですか
data:[]
Ext.define('MyApp.store.Note', {
extend: 'Ext.data.Store',
requires: ['MyApp.model.Note'],
config: {
model: 'MyApp.model.Note',
data:
[
{id: 1, content: 'Blog 1', categoryid: 1, category: 'Nonsense' },
{id: 2, content: 'Blog 2', categoryid: 1, category: 'Nonsense' },
{id: 3, content: 'Blog 3', categoryid: 2, category: 'Food' }
],
}
});
私は自分のリストを作成しています
Ext.define('MyApp.view.NoteList',{
extend: 'Ext.dataview.List',
xtype: 'notelist',
config: {
store: "Note", //will create the store later
itemTpl: [
'<div>',
' <div>{content}</div>',
' <p>{category}</p>',
'</div>'
],
onItemDisclosure: function(record,btn,index) {
this.push(Ext.create('MyApp.view.RegisterPanel'));
//when the little arrow on the right is tapped
}
},
});