1
votes

In Ext 4.1, I am dropping items to a grid, but the records come in with an id and the phantom flag is set to false, causing the store to remain empty and not add those records to it. even though they appear fine on the grid.

I read several solutions online, and many suggested setting the phantom flag to false and/or setting the id to null, but I am not able to implement this? Where do I set it?

Here are related links:

I tried adding a beforedrop listener on the viewConfig and changing the phantom flag and id there, but that didnot work. Any help?

1

1 Answers

1
votes

I have it working. Try this:

// BUGFIX - when records are copied between grids, the copied record don't get its phantom set
// to true, thus, no Create call will be made to the server.
Ext.override( Ext.data.Model, {

    copy : function(newId) {
        var iNewRecord = this.callParent( arguments );
        iNewRecord.phantom = true;
        return iNewRecord;    
    }
});

I also have my source table with the view config copy set to true, although at the time of writing I have no idea why or whether this even does anything:

Ext.define('BS.view.items.Items' ,
{
    extend: 'BS.tree.Panel',

    ...

    viewConfig: {
        plugins: {
            ptype: 'treeviewdragdrop',
            dragGroup: 'classrooms',
        },

        // notice this
        copy: true            
    },

});