PDA

View Full Version : Copying data from one store to another?



jimmifett
25 Aug 2010, 11:31 AM
I've got 2 grids, grid1, grid2.

grid1 gets it's data from xml, with it's reader defining the fields as 'myId' and 'displayText'.

I'm trying to copy rows selected into grid2's array store:

grid2.getStore().loadData(
grid1.getSelectionModel().getSelections()
);

grid2's array store has the exact same fields defined:

grid1:
reader : new Ext.data.XmlReader({
idPath : '@ID',
fields : [
{ name: 'myId', mapping: '@ID' },
{ name: 'displayText', mapping: '' }
],
record : 'myRecord'
}),

grid2:
fields : [
{ name:'myId', type:'string' },
{ name:'displayText', type:'string' }
],
columns : [
{id: 'display', header:'Display', dataIndex:'displayText'}
],


I get the selected number of rows appearing in grid2, but the 'display' column is empty.

What do I seem to be missing here?

Thanks.