ストーリーボードを使用して Xcode で行うように、ST2 でグループ化されたネストされたリストを作成するにはどうすればよいですか? ルート レベルのグループだけが必要です。ネイティブ アプリでの表示例を次に示します。
Sencha の NestedList のドキュメントには何もありませんでした。
ストーリーボードを使用して Xcode で行うように、ST2 でグループ化されたネストされたリストを作成するにはどうすればよいですか? ルート レベルのグループだけが必要です。ネイティブ アプリでの表示例を次に示します。
Sencha の NestedList のドキュメントには何もありませんでした。
ST2 では、NestedList メソッド getSubList() が getList() になり、動作が少し異なります。グループ化情報を伝播するためにそれをオーバーライドすると、私にとってはうまくいきました:
/**
* Override Ext.dataview.NestedList.getList to propagate grouping info from
* parent NestedList to List sublist.
*/
getList: function(node) {
var list = this.callParent(arguments);
list.grouped = this.grouped;
list.store.setGrouper(this.getStore().config.grouper);
return list;
}
Sencha Touch フォーラムで既に質問されています。
http://www.sencha.com/forum/showthread.php?122238-Grouped-Nested-List .
KitchenSink の例を見ることができます (ユーザー インターフェイス -> リスト -> グループ化) http://docs.sencha.com/touch/2-0/#!/example/kitchen-sink
store に storers/grouper 属性があるだけの単純なリストです。
Ext.create('Ext.data.Store', {
id: 'ListStore',
model: 'Contact',
sorters: 'firstName',
grouper: function(record) {
return record.get('firstName')[0];
},
data: [...
そして、リスト項目の設定でそれを呼び出します:
items: [{
width: Ext.os.deviceType == 'Phone' ? null : 300,
height: Ext.os.deviceType == 'Phone' ? null : 500,
xtype: 'list',
store: 'ListStore',
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}</div>',
grouped: true,
indexBar: true
}]
それが役立つことを願っています:)
単純なグループ化されたリストを作成し、グループ ヘッダーの「タップ」イベントを設定します。ヘッダーをタップすると、別のパネルが開き、そのグループのアイテムのみを含むリストが表示されます。