PDA

View Full Version : Facing issue with filtered store while binding it to dataview



mk.ranjan
19 Aug 2012, 9:40 AM
Hi ,
Am trying to bind my store after applying filterBy function to it and binding it to dataview.
But the dataview is not taking the filtered store rather it is taking the original store.

Find below my code
Store:

var mystore = Ext.create('Ext.data.XmlStore', {
model: 'songModel',
proxy: {
type: 'ajax',
url : 'data/dv.xml',
reader: {
type: 'xml',
root: 'list',
record: 'songs'
}
},
oad:true
});

Model:

Ext.define('songModel', {
extend: 'Ext.data.Model',
fields: ['title','author', 'date','category']
});


and my dataview code :

var datav = new Ext.DataView({
autoScroll: true,
tpl: tpl,
autoHeight: false, multiSelect: true,
overClass: 'x-view-over', itemSelector: 'div.thumb-wrap',
emptyText: 'No images to display',
style: 'border:1px solid #99BBE8;'
})

tpl is defined somewhere in the code.. pl dont consider it as a issue
Here am binding the store:


mystore.filterBy(function(record,id){
return record.get('category') == 'melofy';
});

datav.bindStore(mystore);

Please help me out in resolving the issue

sword-it
19 Aug 2012, 11:17 PM
Hi ranjan,

Filtered Store work fine with bindStore() method, i would like suggest you to check your store(what it have) after filtering that store.

Here is working sample example - http://jsfiddle.net/QQjU5/

mk.ranjan
20 Aug 2012, 1:45 AM
Thanks for the reply,
While the issue is resolved now... i was calling createFilter method after filtering it as i was using for loop to display filtered data on different view..

After calling the createFilter method before .filterBy method it started working..

But it still look strange to me..