PDA

View Full Version : Ext.data.Store in Ext.DataView



shakul
10 Mar 2011, 3:37 AM
Hello!

I'm trying to create a Ext.DataView with data from Ext.data.Store.

Here is my DataView:


buildDv : function()
{
//.. some code to retrieve my data.

store = new Ext.data.Store({
proxy : new Ext.ux.data.PagingMemoryProxy(myData),
remoteSort : true,
reader : new Ext.data.ArrayReader({
fields : [
{name : 'name'},
{name : 'id'}
]
}),
remoteSort : true,
storeId : 'myStore',
root : ''
})

return new Ext.DataView({
id : 'myDv',
tpl : template,
store : store,
singleSelect : true,
overClass : 'emplOver',
selectedClass : 'emplSelected',
itemSelector : 'div.friendsWrap',
emptyText : 'No records to display',
autoScroll : true,
style : 'background-color: #ffffff;',
listeners : {
activate : function(thisDv) {
console.log(thisDv, ' activated');
},
click : function(thisDv, index)
{
//.. some code
}
}
})
}
Some facts:
The DataView works when I use a static ArrayStore instead of my DataStore.
The store works when I put it in a GridPanel.
I don't get any errors in the console window.

I guess I will have to update my store/view in order to retrieve my data.
In my grid I use a listener like this:


//...
listeners :
{
render : function(myGrid){
var store = myGrid.getStore();
store.load({params:{start:0, limit:10}});

}
}

Is it a way to do this in DataView?

Any suggestions? :-?

Thanks in advance ~o)

steffenk
10 Mar 2011, 3:42 AM
simply load the data


var dv = this.buildDv();
dv.store.load();

shakul
10 Mar 2011, 4:35 AM
Thanks for reply.
I will give it a try :)