PDA

View Full Version : help in 'datachanged' event



Zoze
13 Aug 2009, 2:10 AM
Hi guys,

I have a grid (GridPanel) and load JSON data using:

store.loadData(data)
where

store = new Ext.data.JsonStore({
root: 'rows',
fields: this.fields
});

I have also a textarea. For each row of grid, a sentence is created in textarea (which contains explanatory stuff related to row). I use local sorting for my grid.

I want each time I sort a column of the grid (so rows are re-ordered), the sentences
of textarea to be re-ordered accordingly.

I tried to invoke "datachanged" event each time I sort columns, and noticed that textarea sentences are re-ordered, but not in proper order. My code snippet:

store.on('datachanged', function (ds) {
for (var i = 0; i < ds.getCount(); i++) {
//do something
}
}, this);

If I apply a 'delay' using alert (just for testing), the ordering is fine. Do you have any ideas that might help me ? Thanks in advance.