Skip to content Skip to sidebar Skip to footer

How To Set An Extjs Grid Record Phantom To True

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 i

Solution 1:

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            
    },

});

Post a Comment for "How To Set An Extjs Grid Record Phantom To True"