1. #1
    Sencha User voodoov's Avatar
    Join Date
    Mar 2012
    Posts
    34
    Answers
    1
    Vote Rating
    0
    voodoov is on a distinguished road

      0  

    Default Unanswered: MVC: Iterate through Store in Grid Panel

    Unanswered: MVC: Iterate through Store in Grid Panel


    Hi,

    I want to get the Store from Grid so I can iterate through it, but when I use getStore() method, it returns only String Name of my Store. These are my codes:

    Users.js (Store)
    Code:
    Ext.define('MyApp.store.Users', {
        extend: 'Ext.data.Store',
        
        model: 'MyApp.model.User',
        autoLoad: true,
            
        proxy: {
            type: 'ajax',
            api: {
                read: 'data/data.json'
            },
            reader: {
                type: 'json',
                root: 'UserInfo["User-1"]'
            }
        }
    });
    User.js (Model)
    Code:
    Ext.define('MyApp.model.User', {
        extend: 'Ext.data.Model',
    
        fields: ['0','1','2','3','4','5']
    });
    UserList.js (View)
    Code:
    Ext.define('MyApp.view.UserList' ,{
        extend: 'Ext.grid.Panel',
        alias : 'widget.userlist',
    
        store: 'Users',
            
        initComponent: function() {
                    
            var store = this.getStore(); // store = 'Users' (?)
                    
            this.columns = [
                {header: 'A', dataIndex: '0', flex: 1},
                {header: 'B', dataIndex: '1', flex: 1},
                {header: 'C', dataIndex: '2', flex: 1},
                {header: 'D', dataIndex: '3', flex: 1},
                {header: 'E', dataIndex: '4', flex: 1}
            ];
    
            this.callParent(arguments);
        }
    });
    The grid is showing data without problem, but I don't know how to get Store from it?

    Thank you in Advance.

  2. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,732
    Answers
    33
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    Call getStore() after callParent(arguments). Or look it up using StoreMgr manually...

  3. #3
    Sencha User voodoov's Avatar
    Join Date
    Mar 2012
    Posts
    34
    Answers
    1
    Vote Rating
    0
    voodoov is on a distinguished road

      0  

    Default


    Thank you mankz,
    It works now. And I got what happens here...

    But why the store is empty?
    I have 3 rows of data in my Grid now.

    Code:
        ...
    
        this.callParent(arguments);
        
        var store = this.getStore();  // store = Store Object ( Empty )
        var count = store.getCount(); // count = 0
        debugger;
    Thank you for your support.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi