PDA

View Full Version : Store is currpoted when using load?



dolittle
2 Apr 2011, 2:59 PM
Using version 1.1.

I have a model with an ajax proxy and a store.
I'm loading 25 records to the store.
Than I'm updating the record on a server with a form, without changing the record.
I'm loading the store but can't get the record again.
If I'm using store.clearFilter() before loading the store, it works but I can't see why.

Model:

Ext.regModel("Ticket", {
fields: [
{name: 'id', mapping: 'mod_id'},
{name: 'type', mapping: 'mod_type'}
],
idProperty: 'id',
proxy: {
type: 'ajax',
url : '?get_tickets',
reader: {
type: 'json',
root: 'tickets'
}
}
});

Store:

Ext.regStore('Tickets', {
model: 'Ticket'
});

In the controller, updating the form fields with the record:

var ticket = Ext.getStore('Tickets').getById(options.ticketId);
editView.loadRecord(ticket);

The form fields:

items: [{
xtype: 'fieldset',
items: [{
xtype: 'selectfield',
name : 'type',
label: 'type'
}, {
xtype: 'hiddenfield',
name: 'id'
}]
}],

Submitting the form and load the store on succcess:

this.submit({
success: function(form) {
this.store.clearFilter(); // ?????
this.store.load();
}
});

After loading the store in the success of the form submit I can see that the store have 25 records including the record the form updated on the server but I can't get it with store.getById(ticketId).

When using store.clearFilter before loading the store it first set the store.getCount() to 0 ?? and after load I can get the record with store.getById(ticketId).

Thanks