PDA

View Full Version : "Uncaught DataView requires tpl, store and itemSelector configurations to be defined"



ikteivi
4 Jul 2011, 1:17 AM
Hello.
I'm new to Sencha, so please bear with me.

I have created a store and a model. I know that the store gets the data that it should by checking it in the console.

The problem is that i want to have a panel with items: DataView, so that it will always update itself when i load/update data in the store.

Here is the code:

View:

var buttonTemplate = new Ext.XTemplate
(
'<tpl for=".">',
' <div class="home_button_container">',
' <img class="home_button" src="{url_icon_large}" />',
' <p class="home_button_text">{name}</p>',
' </div>',
'</tpl>'
);

ToolbarDemo.views.Homecard = new Ext.Panel({

title: "Meny",
iconCls: "home",
scroll: "vertical",
bodyStyle: "background-color: #FFFFFF !important; background-image: url(images/background.png) !important; background-repeat:no-repeat; background-position:bottom left;",
initComponent: function()
{
ToolbarDemo.views.Homecard.superclass.initComponent.apply(this, arguments);
},
dockedItems:
[
{
xtype: "toolbar"
}
],
defaults: {height: "110px"},
items: new Ext.DataView(
{
tpl:buttonTemplate,
store: ToolbarDemo.stores.feedStorer,
autoHeight:true,
multiSelect: true,
loadingText: 'Laster data',
itemSelector:'div.home_button_container',
emptyText: 'No images to display'
})
});


Model:

Ext.regModel('Feeds', {
fields: [
{name: 'name', type: 'string'},
{name: 'url_icon_small', type: 'string'},
{name: 'url_icon_medium', type: 'string'},
{name: 'url_icon_large', type: 'string'},
{name: 'url_icon_large_p', type: 'string'},
{name: 'url', type: 'string'},
{name: 'sort_order', type: 'string'}
]
});

Store:

ToolbarDemo.stores.feedStore = new Ext.data.Store({
model: 'Feeds',
storeId: 'feedStore',
proxy: {
type: 'scripttag',
url : 'http://localhost/webservice/feeds.php?username=' + sUsername + '&password=' + sPassword,
reader: {
type: 'json',
root: 'feeds'
}
},
autoLoad: true
});

But when i run this i get the
"Uncaught DataView requires tpl, store and itemSelector configurations to be defined"
error.

I can't see what i'm doing wrong here, as i have given the DataView a tpl, store, and itemSelector.

Does anyone have a suggestion?
Thanks in advance