PDA

View Full Version : Store not loading data, but page is fetched correctly



Fire-Dragon-DoL
30 May 2012, 3:42 AM
I'm just going mad guys, I always used stores around my application but now I don't understand because one doesn't load data.

I'm using the store for a combobox, but the problem is not connected to it because I'm trying to load the store through Firebug:

Ext.getStore('Cities').load()

The operation is successful (tested with a callback), I can see in firebug that I get a response with a big json object.
However, the data of the store is empty (0 items).

Any suggestion on what the issue is? I'm posting here the store and the model (and a part of the big json object)

Model

Ext.define('FedertrekDesktop.model.City', {
extend: 'Ext.data.Model',

proxy: {
type: 'ajax',
url: '/cities/index.extjson',
reader: {
type: 'json',
root: 'root'
}
},

fields: [
{
name: 'id',
type: 'string'
},
{
name: 'name',
type: 'string'
},
{
name: 'province',
type: 'string'
},
{
name: 'region',
type: 'string'
},
{
name: 'cap',
type: 'string'
}
],

idProperty: 'id'

});

Store

Ext.define('FedertrekDesktop.store.Cities', {
extend: 'Ext.data.Store',
model: 'FedertrekDesktop.model.City',

buffered: true,
pageSize: 100,

remoteSort: true,
remoteFilter: true,

autoSync: true
});

JSON


{"success":true,"total":8083,"message":"","root":[{"cap":12051,"created_at":"2011-11-23T18:26:32Z","id":101,"name":"Alba","province":"CN","region":"PIE","updated_at":"2011-11-23T18:26:32Z"},{"cap":64011,"created_at":"2011-11-23T18:26:32Z","id":102,"name":"Alba Adriatica","province":"TE","region":"ABR","updated_at":"2011-11-23T18:26:32Z"},...]}

Fire-Dragon-DoL
30 May 2012, 3:50 AM
I just understood that the problem is the option buffered

Why? How can I keep loading data when scrolling the combobox? The store is really big (8000+ elements) and I would like to do something similar like grid, when you scroll data is kept loading.