1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    55
    Vote Rating
    0
    Answers
    1
    twisted_zero is on a distinguished road

      0  

    Default Answered: list problem (no errors, no data)

    Answered: list problem (no errors, no data)


    i am trying to implement a list in my panel.
    there are no warnings or errors, but i don't see the data

    the view:
    Code:
    Ext.define('app.view.home', {
        extend: 'Ext.Panel',
        xtype: 'homePage',
       
        config: {
            fullscreen: true,
            
            items: [
                {
                    xtype: 'toolbar',
                    title: 'Dossiers',
                    docked: 'top',
                },{
                    xtype: 'toolbar',
                    docked: 'bottom',
                    items: [
                        {
                            xtype: 'button',
                            text: 'Logout',
                            ui: 'back',
                            id:'Logout-btn',
                        },{
                            xtype: 'button',
                            iconMask: true,
                            iconCls: 'user',
                            text: 'settings',
                            id:'user-btn',
                        },{ 
                            xtype: 'spacer'
                        },{
                            xtype: 'button',
                            iconMask: true,
                            iconCls: 'add',
                            id:'tabform-btn',
                        }
                    ]
                },{
                    xtype:'list',
                    store:'Dossiers',
                    itemTpl:'{name}'
                },
            ]
    
    
        },
        initialize: function() {
            this.callParent(arguments);
            console.log('homeView:initialize');
        },
    });
    the store:
    Code:
      Ext.define('app.store.Dossiers', {
        extend: 'Ext.data.Store',
        requires: 'app.model.Dossier',
        
        config:{
            model: 'app.model.Dossier',
            
            proxy: {
                type: 'ajax',
                url: 'app/model/data/dossiers.json',
                reader: {
                    type: 'json',
                }
            } ,
        autoLoad: true
        }
    });
    the model:
    Code:
    Ext.define('app.model.Dossier', {
        extend: 'Ext.data.Model',
        config: {
            fields: [
                {
                name: 'id',
                type: 'string'
                }, {
                name: 'name',
                type: 'string'
                }
            ]
        },
     });
    the data:
    Code:
    [
        { "id": 1, "name": "azerty" },
        { "id": 7, "name": "jan" },
        { "id": 4, "name": "hello world" }    
    ]

  2. got it!

    added in the config:
    Code:
    layout: 'fit',
    now it seems to work.
    thanks all

  3. #2
    Sencha User
    Join Date
    Nov 2011
    Posts
    9
    Vote Rating
    0
    Nserra is on a distinguished road

      0  

    Default


    I haven't tested your code or really look close to it but you've defined a field: 'id' of type string and than pass numbers on it.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    55
    Vote Rating
    0
    Answers
    1
    twisted_zero is on a distinguished road

      0  

    Default


    i see you're point, but also when i comment out the id's, the problem still exists

  5. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    19
    Vote Rating
    0
    clozeboy is on a distinguished road

      0  

    Default


    i'm facing the same problem, kindly help

  6. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    31
    Vote Rating
    5
    chrisminniti is on a distinguished road

      0  

    Default


    your autoLoad: true is outside the config

  7. #6
    Sencha User
    Join Date
    Mar 2012
    Posts
    31
    Vote Rating
    5
    chrisminniti is on a distinguished road

      0  

    Default


    here is a snippet of a working store of mine.

    Code:
    Ext.define('TopicApp.store.DiversityStore', {            
    extend: 'Ext.data.Store',
                config: {
                    autoLoad: true,
                    model: 'TopicApp.model.DiversityModel',
                    proxy: {
                        type: 'ajax',
                        url: "someurl.com",
                        reader: {
                            type: 'xml',             
                           record: 'properties'
                        }
                    }
                }
    });

  8. #7
    Sencha User
    Join Date
    Mar 2012
    Posts
    55
    Vote Rating
    0
    Answers
    1
    twisted_zero is on a distinguished road

      0  

    Default


    my autoLoad is in the config-block.
    It has to be something else

  9. #8
    Sencha User
    Join Date
    Mar 2012
    Posts
    31
    Vote Rating
    5
    chrisminniti is on a distinguished road

      0  

    Default


    you are right. your autoload is inside the config.
    Last edited by chrisminniti; 5 Apr 2012 at 7:12 AM. Reason: eating my words

  10. #9
    Sencha User
    Join Date
    Mar 2012
    Posts
    31
    Vote Rating
    5
    chrisminniti is on a distinguished road

      0  

    Default


    have you tried putting it up right below the config open?

  11. #10
    Sencha User
    Join Date
    Mar 2012
    Posts
    55
    Vote Rating
    0
    Answers
    1
    twisted_zero is on a distinguished road

      0  

    Default


    Quote Originally Posted by chrisminniti View Post
    have you tried putting it up right below the config open?
    you mean like this?
    Code:
      Ext.define('app.store.Dossiers', {
        extend: 'Ext.data.Store',
        requires: 'app.model.Dossier',
        
        config:{
            autoLoad: true,
            model: 'app.model.Dossier',
            
            proxy: {
                type: 'ajax',
                url: 'app/model/data/dossiers.json',
                reader: {
                    type: 'json',
                }
            } ,
        }
    });
    same result, didn't work either