PDA

View Full Version : Problem with load store upon migration to Ext 4.1



vinuthamsr
5 Jul 2012, 9:35 PM
Hello,

I am facing strange problem using this.store.load() function. The Json data is properly received from the server side as well as seen in the proxy->reader->jsondata

But the store is not able to save data here.
Please help in case there is problem with my code which I have attached below.



initComponent: function() {
Ext.apply(this, {
columns: [{
flex: 1,
sortable : true,
dataIndex: 'label',
renderer: this.formatTitle
},{
header : '',
width : 75,
sortable : true,
dataIndex: 'size',
align : 'right',
renderer : Ext.util.Format.numberRenderer('0,000')
}
],
store: Ext.create('KE.store.BrowseClasses', {
proxy : Ext.create('KE.proxy.BrowseClassesProxy', {})
})
});

this.callParent(arguments);
this.loadStore();
},

loadStore: function() {
this.store.load({
scope : this,
params: {
'time': new Date().getTime()
},
callback: function(records, operation, success) {
console.log(records);
//filterBy can only be called after load is successful
this.store.filterBy(function myfilter(record) {
console.log('iff');
//filter away values other than the following
if ( (record.get("localname") == "TechOffer") ||
(record.get("localname") == "TechAlertSubscriber") ||
(record.get("localname") == "BrochureDownloader") ||
(record.get("localname") == "Brochure") ||
(record.get("localname") == "Article") ||
(record.get("localname") == "Organization") ||
(record.get("localname") == "SystemDataSourceType")){

return true;
}
else
return false;
});
}
});
}

I am able to see the console.log(records) as an array containing 133 elements.

skirtle
6 Jul 2012, 5:38 AM
What is it that you're saying doesn't work?

What happens if you remove the filterBy call?

Can you add this?


console.log(record.get('localname'));

Does your model definitely contain the localname field?

vinuthamsr
6 Jul 2012, 8:18 AM
Hi,

Well, I figured out the problem.
The model was proper. Localname is displayed well.
The problem was with the store which was configured with 'buffered: true' and with the new changes, I think all the records needed to be prefetched. So once I removed the parameter 'buffered' it started to load correctly.

Thanks again for your help.
Vinutha