extjs拖拽,请教高手

PageModelGridPanel = Ext.extend(Ext.grid.GridPanel, {
title: 'Module对应的panel源数据',
width: 550,
autoScroll: true,
columnWidth:.5,//表示列宽为一半
animate: true,
containerScroll: true,
enableDragDrop: true,  
    ddGroup: "tgDD",  //这个就是注册一个可拖拽的panel,放到相应的组当中
    height: 320,
smtId:"",
store: "",
listeners: {

notifyDrop : function(dd, e, data) {
alert("12346");
var sm = grid.getSelectionModel();  
var rows = sm.getSelections();  

var cindex = dd.getDragData(e).rowIndex;  
alert(sm);
alert(rows);
alert(cindex);
if (cindex == undefined || cindex < 0){  
e.cancel=true;  
return;  
}  
for (i = 0; i < rows.length; i++) {  
   rowData = ds.getById(rows[i].id);  
if (!this.copy) {  
ds.remove(ds.getById(rows[i].id));     
ds.insert(cindex, rowData);             
}  
}  
    }

},

initComponent: function(){
// var p = this.PageModelGridPanel;
// var drop = new Ext.dd.DropZone(p.el);

this.store = new Ext.data.JsonStore({
url: webContext+'/pageModel/pagePanelManage.do?methodCall=findPagePanelByModule',
fields: ['id','name','leaf'],
    root:'data',
sortInfo: {field: "id", direction: "ASC"}
}),
this.cm = new Ext.grid.ColumnModel([  
      
    {header: "所属panel名称", width: 150, sortable: true, dataIndex: 'name'},
    {header: "leaf", width: 100, sortable: true, dataIndex: 'leaf'},
    {id:'id', header: "id", width: 100, sortable: true, dataIndex: 'id'}
]),

this.grid = new Ext.grid.EditorGridPanel({
        store: this.store,
        cm: this.cm,
        trackMouseOver:false,   
        loadMask: true
}); 

PageModelGridPanel.superclass.initComponent.call(this);
}

});





你可能感兴趣的:(ext)