リスト内の行に別の背景色を与える必要があったため、sencha touch リストに行き詰まりました。リストの行にテキストフィールド、ボタン、画像を追加する必要があるため、 sencha touch でリストをカスタマイズする方法がもう 1 つ疑問です。html で試してみたところ、できました。sencha touch オブジェクト項目をリストに直接追加する方法はありますか。助けてください。
2064 次
1 に答える
1
cls : 'customCls'
このコンポーネントの要素に追加されるオプションの追加の CSS クラスを使用できます(デフォルトは '')。これは、標準の CSS ルールを使用して、カスタマイズされたスタイルをコンポーネントまたはその子に追加する場合に役立ちます。そして、多分あなたはこれをチェックしたいです
編集:
Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});
var store = new Ext.data.JsonStore({
model : 'Contact',
sorters: 'lastName',
getGroupString : function(record) {
return record.get('lastName')[0];
},
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Michael', lastName: 'Mullany'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'}
]
});
Ext.onReady(function() {
var list = new Ext.List({
fullscreen: true,
itemTpl : '{firstName} {lastName}',
grouped : true,
indexBar: true,
store: store,
listeners: { // here you can add itemtap event and retrieve index number!
itemtap:function(item,index, e){
console.log(index);
//so, now that you have index , you can access specific item
console.log(this.store.data.items[index]);
}
},
});
list.show();
console.log(list.getStore().data.items[0]);
// here you are accessing list store and then store data and then store item with index 0
});
于 2011-10-14T08:51:02.797 に答える