urcm
urcm

Reputation: 2284

extjs gridpanel drag and drop feature

Ext.namespace('Moca');
.....

Moca.LaGrid = new Ext.grid.GridPanel({
store : Moca.Stores.LaStore,
ddGroup: 'GridDD',
enableDragDrop: true,
.....


  var ddrow = new Ext.dd.DropTarget(Moca.LaGrid.getView().mainBody, {
            ddGroup : 'GridDD',
            copy:false,
            notifyDrop : function(dd, e, data){
                var sm=Moca.LaGrid.getSelectionModel();
                var rows=sm.getSelections();
                var ds = Moca.LaGrid.store;
                var cindex=dd.getDragData(e).rowIndex;
                for (i = 0; i < rows.length; i++) {
                    rowData=c.getById(rows[i].id);
                    if(!this.copy) {
                        ds.remove(ds.getById(rows[i].id));
                        ds.insert(cindex,rowData);
                    }
                };
            }
        });  

it is giving this.el is null ext-all.js (line7)

pls help?

Upvotes: 2

Views: 2584

Answers (1)

splusk
splusk

Reputation: 51

First guess would be that Moca.LaGrid has not been rendered to its container at the time ddrow was created, thus Moca.LaGrid.getView().mainBody would be null. Try creating ddrow after the GridPanel has been attached to its container.

Upvotes: 1

Related Questions