2

私は次のコードを持っています

Ext.regModel('Centre', {
   fields: ['name', 'url']
}); 

Ext.application({
    name: 'Sencha',

    launch: function() {

         var panel = new Ext.Panel({
        fullscreen: true,
        dockedItems: [
          {
            xtype: "toolbar",
            dock: "top",
            title: "DEMO APP"

          },
          {
            xtype: "toolbar",
            items: [
              {
                iconMask: true,
                iconCls: "download"
              },
              {
                iconMask: true,
                iconCls: "favorites"
              },
              {
                iconMask: true,
                iconCls: "search"
              },
              {
                iconMask: true,
                iconCls: "user"
              }
            ]  
          },
          {
            xtype: 'list',
            itemTpl: '{name}',
            sorters: 'name',

            store: {
                fields: ['name', 'url'],
                   data: centers
            },
            itemConfig: {
              tpl: '{url}'
            },
            listeners: {
              itemtap:function(data,index){
                var record = data.getStore().getAt(index);
                redirect_url = record.raw.url
                 // the record that has been clicked.
                 window.location = redirect_url
              }
            }
          },


        ]
      });   


   }
});

centersセンターのリストがあります。リストを並べ替えてグループ化したい。getGroupString()を試しましたが、役に立ちませんでした。何かが足りないのかもしれません。

4

2 に答える 2

3

リストにはconfigプロパティが必要ですgrouped:true

(// indexBar:true as well if you want the alphabet on the side)

getGroupStringあなたの店は機能を実装する必要があります

getGroupString: function(record) { return record.get('name') }
于 2011-11-08T19:54:21.037 に答える
2

2.1以降を使用している場合、構文は、構成内のgroupFn関数を使用してグループオブジェクトを定義することです。

grouper: {
    groupFn: function(record) {
        return record.get('name').substr(0, 1);
    },
    sortProperty: 'name'
}
于 2013-07-28T22:30:09.727 に答える