-
4 Apr 2012 5:07 AM #1
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:
the store: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 model: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 data:Code:Ext.define('app.model.Dossier', { extend: 'Ext.data.Model', config: { fields: [ { name: 'id', type: 'string' }, { name: 'name', type: 'string' } ] }, });
Code:[ { "id": 1, "name": "azerty" }, { "id": 7, "name": "jan" }, { "id": 4, "name": "hello world" } ]
-
Best Answer Posted by twisted_zero
got it!

added in the config:
now it seems to work.Code:layout: 'fit',
thanks all
-
4 Apr 2012 5:50 AM #2
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 Apr 2012 6:00 AM #3
i see you're point, but also when i comment out the id's, the problem still exists
-
4 Apr 2012 11:56 AM #4
-
4 Apr 2012 3:36 PM #5
-
4 Apr 2012 3:39 PM #6
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' } } } });
-
5 Apr 2012 3:16 AM #7
my autoLoad is in the config-block.
It has to be something else
-
5 Apr 2012 7:05 AM #8
you are right. your autoload is inside the config.
Last edited by chrisminniti; 5 Apr 2012 at 7:12 AM. Reason: eating my words
-
5 Apr 2012 7:08 AM #9
have you tried putting it up right below the config open?
-
5 Apr 2012 7:23 AM #10
you mean like this?
same result, didn't work eitherCode: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', } } , } });


Reply With Quote