2

ストーリーボードを使用して Xcode で行うように、ST2 でグループ化されたネストされたリストを作成するにはどうすればよいですか? ルート レベルのグループだけが必要です。ネイティブ アプリでの表示例を次に示します。

Sencha の NestedList のドキュメントには何もありませんでした。

ここに画像の説明を入力

4

4 に答える 4

1

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;
}
于 2013-01-31T22:29:58.360 に答える
0

Sencha Touch フォーラムで既に質問されています。

http://www.sencha.com/forum/showthread.php?122238-Grouped-Nested-List .

于 2012-05-30T03:10:06.670 に答える
0

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
        }]

それが役立つことを願っています:)

于 2012-05-30T09:11:55.467 に答える
0

単純なグループ化されたリストを作成し、グループ ヘッダーの「タップ」イベントを設定します。ヘッダーをタップすると、別のパネルが開き、そのグループのアイテムのみを含むリストが表示されます。

于 2012-05-30T12:26:42.583 に答える