Extjs4 - Save duplicate entries. Is it possible?

Can I add duplicate records to the data warehouse?

var myData = [
{ id : 0, name : "Rec 0", column1 : "0", column2 : "0" },
{ id : 1, name : "Rec 1", column1 : "1", column2 : "1" },
{ id : 2, name : "Rec 2", column1 : "2", column2 : "2" },
{ id : 3, name : "Rec 3", column1 : "3", column2 : "3" },
{ id : 4, name : "Rec 4", column1 : "4", column2 : "4" },
{ id : 5, name : "Rec 5", column1 : "5", column2 : "5" },
{ id : 6, name : "Rec 6", column1 : "6", column2 : "6" },
{ id : 7, name : "Rec 7", column1 : "7", column2 : "7" },
{ id : 8, name : "Rec 8", column1 : "8", column2 : "8" },
{ id : 9, name : "Rec 9", column1 : "9", column2 : "9" }
];


var origine = new Ext.data.Store({
        //autoDestroy: true,
        storeid: 'origineRec',
        id:'origineRec',
        //model: 'DataObject',
        //idIndex: 0,
        fields: ['id','name','column1 ','column2 '],
        data: myData 
});

var destinazione = new Ext.data.Store({
        //autoDestroy: true,
        storeid: 'destinazioneRec',
        id:'destinazioneRec',
        //idIndex: 0,
        fields: ['id','name','column1 ','column1 ']
});

I have such a situation, two grids, two stores, and I have to drag and drop the entry and go to "destinazione", and this allows me to allow duplicate entries.

I add duplicate records to the second grid (Rec 0 - Rec 0), but after saving to the grid there is only one record.

How can i fix it? thank

+3
source share
1 answer

By default, a property idis a primary key, and you cannot have more than one record in the repository with the same key. You can change the primary by pointing idPropertyto something else, but this will not solve your problem in any case.

, , .

+2

All Articles