WORKS: When I do this, the LIST is populated and is displayed:
app.js
Code:
models: ["Link"],
stores: ['Links'],
views/Links.js
Code:
Ext.define('Main.view.Links', {
extend : 'Ext.dataview.List',
xtype : 'linkscard',
fullscreen : true,
config : {
title : 'Go to…',
iconCls : 'action',
styleHtmlContent : true,
itemTpl : ['<h1>{title}</h1> - {description}'],
data: [
{id: 0, url: '', title: 'CNN', description: 'News from around the world' },
{id: 1, url: '', title: 'Yahoo', description: 'Search engine' },
{id: 2, url: '', title: 'MSA', despcription: 'Mustard Seed Academy' },
{id: 3, url: '', title: 'Google', description: 'Another big search engine' }
],
items : [{
docked : 'top',
xtype : 'titlebar',
title : 'Go To…',
items : [{
iconCls : 'refresh',
iconMask : true,
align : 'left'
}]
}]
}
});
NOT WORKING: However, when I do the following, it doesn't populate. The only thing displayed is one empty template item.
views/Links.js
Code:
Ext.define('Main.view.Links', {
extend : 'Ext.dataview.List',
xtype : 'linkscard',
fullscreen : true,
config : {
title : 'Go to…',
iconCls : 'action',
styleHtmlContent : true,
storeId: 'LinkStore',
store: ['Main.store.Links'],
itemTpl : ['<h1>{title}</h1> - {description}'],
items : [{
docked : 'top',
xtype : 'titlebar',
title : 'Go To…',
items : [{
iconCls : 'refresh',
iconMask : true,
align : 'left'
}]
}]
}
});
store/Links.js
Code:
Ext.define('Main.store.Links', {
extend: 'Ext.data.Store',
alias: 'store.Links',
config: {
model: 'Main.model.Link',
storeId: 'LinkStore',
data: [
{id: 0, url: '', title: 'CNN', description: 'News from around the world' },
{id: 1, url: '', title: 'Yahoo', description: 'Search engine' },
{id: 2, url: '', title: 'MSA', despcription: 'Mustard Seed Academy' },
{id: 3, url: '', title: 'Google', description: 'Another big search engine' }
]
}
});
model/Link.js
Code:
Ext.define('Main.model.Link', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'id', type: 'int'},
{name: 'url', type: 'string'},
{name: 'title', type: 'string'},
{name: 'description', type: 'string'}
]
}
});
Can someone tell me what I'm doing wrong?
Also, what is the need for "alias"? If I don't include it, then even the empty template item is not displayed.
Ultimately, what I want to do is to get in-line data working before I move to grabbing external JSON data.
Thank you ahead!