开发者

extjs gridpanel drag and drop feature

开发者 https://www.devze.com 2023-02-19 00:14 出处:网络
Ext.namespace(\'Moca\'); ..... Moca.LaGrid = new Ext.grid.GridPanel({ store : Moca.Stores.LaStore, ddGroup: \'GridDD\',
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 ex开发者_开发百科t-all.js (line7)

pls help?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消