Pravin
Pravin

Reputation: 6662

Sencha touch list group

I have a list:

{
    xtype: 'list',
    itemTpl: '{name}',
    sorters: 'name',
    getGroupString: function(record) 
        { 
            return record.get('name')
         },
    indexBar:true,
    grouped: true,
    store: {
        fields: ['name', 'url'],
           data: centres
    },
    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
      }
    }
  }

I want to group the list by name. But results are not being grouped.

Upvotes: 0

Views: 3450

Answers (1)

stan229
stan229

Reputation: 2607

the sorters (takes an array of Strings), getGroupString are part of the store. The store also needs a model to back it.

I'm not sure what you're trying to do with both itemTpl and itemConfig displaying two different things, if you want to show the name property in the list then you just need the itemTpl.

See the KitchenSink List example: http://docs.sencha.com/touch/2-0/#!/example/kitchensink/index.html

User Interface --> List and hit the Source button on the upper right hand corner.

Upvotes: 1

Related Questions