Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Answers
    4
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Exclamation Unanswered: Grouped List w/store?

    Unanswered: Grouped List w/store?


    The KitchenSink Grouped List works but it's not using a Store. I can't seem to get my Grouped List to work with a Store. If I remove "grouped:true", the list displays but sans grouping and index bar. I suspect that either I need to configure the store differently OR that there's a bug in the PR1 release.

    Has anyone gotten a Grouped List to work WITH a Store?

    Also, what are the "groupers" and "groupField" Store parameters for? I've tried with and without them and neither case works.

  2. #2
    Sencha Premium Member Martin1982's Avatar
    Join Date
    Aug 2011
    Location
    The Netherlands
    Posts
    109
    Answers
    4
    Vote Rating
    0
    Martin1982 is on a distinguished road

      0  

    Default


    Could you post some code to see what you are doing now?

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Answers
    4
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Default


    Here are snippets of the relevant sections:

    Store:
    Code:
    Ext.define('MyApp.store.EmployeesStore', {
               extend  : 'Ext.data.Store',
               model   : 'MyApp.model.Employee',
               requires: ['MyApp.model.Employee'],          
               sorters: 'lastName',
               getGroupString: function(record) {
                return record.get('lastName')[0];
               }           
               });

    View configuration:

    Code:
            {
                xtype: 'panel',
                id: 'thepanel',
                layout: 'fit',
                items: [
                {
                    id: 'thelist',
                    xtype: 'list',
                    itemTpl: '<span>{firstName} <b>{lastName}</b></span>',
                        grouped: true,
                        indexBar: true
                }
                ]
            }
    and

    Code:
        initialize: function() {
            console.log('initialize:');
            var theList = this.down('#thelist');
            var theStore = new MyApp.store.EmployeesStore();
            // add Employee objects to store
     
            theList.setStore(theStore);

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Answers
    28
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    I think there might be an issue with list.setStore atm. Are you using the new MVC architecture? If that is the case you should be able to just do:

    PHP Code:
            {
                
    xtype'panel',
                
    id'thepanel',
                
    layout'fit',
                
    items: [
                {
                    
    id'thelist',
                    
    xtype'list',
                    
    itemTpl'<span>{firstName} <b>{lastName}</b></span>',
                    
    groupedtrue,
                    
    indexBartrue,
                    
    store'EmployeesStore'
                
    }
                ]
            } 
    As long as you define stores: ['EmployeesStore'] in your Application or any Controller.

Thread Participants: 2