PDA

View Full Version : List not showing any items



MrSlayer
10 Sep 2011, 6:53 PM
I am trying to create a simple list in a MVC structure and everything is rendering properly, except the list is not showing any items in it. I've tried everything I can think of. Full source can be viewed at http://music.mrslayer.com, tempuser/senchaforum.

Here is the code for the screen in question, in order of how the files are loaded...

Artist Model


App.models.Artist = Ext.regModel( 'ArtistModel',
{
fields :
[
{ name : 'name', type : 'string' }
]
} );

Ext.reg( 'ArtistModel', App.models.Artist );


Artist Store


App.stores.Artists = Ext.extend( Ext.data.Store,
{
model : 'ArtistModel',
sorters : 'name',
getGroupString :
function ( record )
{
return record.get( 'name' )[0];
},
autoLoad : true,
data :
[
{ name : 'Slayer' },
{ name : 'Cannibal Corpse' },
{ name : 'Meshuggah' }
]
} );

Ext.reg( 'ArtistsStore', App.stores.Artists );


Artist View


App.views.Artists = Ext.extend( Ext.List,
{
store : 'ArtistsStore',
grouped : true,
indexBar : true,
emptyText : 'nothing here.',
itemTpl : '{name}',
initComponent :
function ( )
{
App.views.Artists.superclass.initComponent.call( this );
}
} );

Ext.reg( 'Artists', App.views.Artists );


I'll be honest and say that I am new to the Sencha framework, but I just can't figure out why the list of Artists does not show the three items that I have defined. I'm not seeing any JavaScript errors, either.

Thanks,
Slayer

jason402
19 Sep 2011, 9:26 AM
This is what I do. Plus when I declare my fields, I don't declare the type, so if I was doing yours it would just say fields: [ 'name' ]

here is the rest of my code. I don't use an initComponent either.



contactList.listPanel = new Ext.List({
id: 'disclosurelist',
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
store: contactList.ListStore,
monitorOrientation: true,
listeners: {
itemtap: function(list, index) {
var rec = list.getStore().getAt(index);
var name = rec.data.firstName + " " + rec.data.lastName;
number = rec.data.cellPhone;
contactList.actionToolbar.setTitle(number);
contactList.Viewport.setActiveItem('actionwrapper');
},
itemswipe: function(list, index) {
var srec = list.getStore().getAt(index);
var snumber = srec.data.cellPhone;
Android.call(snumber);
}
},
indexBar: true,
grouped: true
});