PDA

View Full Version : getModifiedRecords



dimitris
30 Jul 2013, 6:10 AM
Hi,

When I use getModifiedRecords on a store I get always all the records of the store and NOT those I modified.
Could you please check where is the problem in my code

grid.getStore().getModifiedRecords().length

My Grid has above settings


var grid = Ext.create('Ext.grid.Panel', { title: 'Airports',
store: Ext.data.StoreManager.lookup('airportsStore'),
columns: columnsModel,
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2
}),
'bufferedrenderer',
],
height: 200,
width: 400
});


Thanks lot
dimitris

tobiu
30 Jul 2013, 6:51 AM
How do you load the data into the store? Manually adding records or a real Store.load()?

It is quite important to use records with a unique id, either using a field with the name "id" or using idProperty to switch to a different field. If you are not using both all records are supposed to be new.

Best regards
Tobias

dimitris
30 Jul 2013, 7:02 AM
Hi, Tobias

I'm loading the store using an array of values
something like this


grid.getStore().loadData(glTmpData);

I used this method of loading since extjs 3.x.
and worked fine

Thank you in advance
Dimitris

tobiu
30 Jul 2013, 7:13 AM
try out using
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store-method-loadRawData

instead and make sure your records have a unique id.

dimitris
1 Aug 2013, 6:15 AM
Hi Tobias

You are right about unique ID (especially Chrome is crashing without this), but
I'm still want to use loadData because I don't have any predefined reader on my store configuration
(data changed dynamically)

So I decide to commit the store after the initial load and everthing is ok now
I suppose this is not very formal job but it works anyway!

Thank you very much again
Dimitris