-
19 Oct 2011 6:32 PM #1
Unanswered: Why isn't the component view populating with store data?
Unanswered: Why isn't the component view populating with store data?
I can not seem to figure out the reason why the component view is not populating with the store data in the below scenario. Hopefully, someone here can help me out because I am at a lost for words.
* No errors or warnings are present.
Thanks
app.js
data.xmlCode:/* * Editorial model */ Ext.define('sms.models.editorial.Editorial',{ extend: 'Ext.data.Model', idProperty: 'id', fields: [ {name: 'id' , type: 'int'}, {name: 'title' , type: 'string'} ] }); /* * Editorial headlines store */ Ext.define('sms.stores.editorial.EditorialHeadlines',{ extend: 'Ext.data.Store', autoLoad: true, pageSize: 20, model: 'sms.models.editorial.Editorial', proxy: { type: 'ajax', url: 'data.xml', reader: { type: 'xml', record: 'editorial' } } }); /* * Editorial headlines view */ Ext.define('sms.views.editorial.Headlines',{ extend: 'Ext.dataview.ComponentView', xtype: 'editorialheadlines', config: { defaultType: 'editoriallistitem', store: 'sms.stores.editorial.EditorialHeadlines' } }); /* * Editorial list item view */ Ext.define('sms.views.editorial.EditorialListItem',{ extend: 'Ext.dataview.DataItem', xtype: 'editoriallistitem', config: { dataMap: { getTitle: { setHTML: 'title' } }, title: { cls: 'title' } }, applyTitle: function(config) { return Ext.factory(config,Ext.Component,this.getTitle()); }, updateTitle: function(newTitle) { if(newTitle) { this.insert(0,newTitle); } } }); Ext.application({ name: 'sms', launch: function() { Ext.create('sms.views.editorial.Headlines',{fullscreen: true}); } });
Code:<?xml version="1.0"?> <editorials> <editorial> <id>1</id> <title>Editorial 1</title> </editorial> <editorial> <id>2</id> <title>Editorial 2</title> </editorial> <editorial> <id>3</id> <title>Editorial 3</title> </editorial> </editorials>
-
19 Oct 2011 7:05 PM #2
hmmm… removed defining the component view and instead instantiating it directly seems to load the items. However, the title is undefined.
Code:Ext.application({ name: 'sms', launch: function() { // Ext.create('sms.views.editorial.Headlines',{fullscreen: true}); /* * Editorial headlines view */ var list = Ext.create('Ext.dataview.ComponentView',{ fullscreen: true, xtype: 'editorialheadlines', defaultType: 'editoriallistitem', store: Ext.create('sms.stores.editorial.EditorialHeadlines') }); } });
-
21 Oct 2011 9:52 AM #3
Anyone have an idea what is going on here or what I am doing incorrectly?
-
25 Oct 2011 8:16 AM #4
same problem
same problem
there are some problema, I think, with the Ext.define
when I instantiate the classes it works but if I try to define and then use it later, nothing happen...
-
27 Oct 2011 4:13 PM #5
Any help here? I mean… is it something that has been done incorrectly or a bug.
-
1 Nov 2011 6:45 PM #6
-
24 Dec 2011 7:15 PM #7
Small thing I noticed, shouldn't setHTML be setHtml?
-
19 Feb 2012 10:21 AM #8
try this
try this
try this way
Ext.define('sms.stores.editorial.EditorialHeadlines',{ extend: 'Ext.data.Store', autoLoad: true, pageSize: 20, model: 'sms.models.editorial.Editorial', proxy: { type: 'ajax', url: 'data.xml', reader: { type: 'xml',// INSERT THIS root: 'editorials',// END INSERT THIS record: 'editorial' } } });


Reply With Quote