GRID 드래그 행의 인스턴스 코드

2130 단어
-----------------GRID 드래그 행의 인스턴스 코드 단일 행 드래그 ---------------------------------------------------
 
  
// GRID
var firstGrid = new Ext.grid.GridPanel({
ddGroup : 'secondGridDdGroup',// GRID ddGroup
store       : firstGridStore,
enableDragDrop : true,//True GridPanel
……
});

// GRID
var secondGrid = new Ext.grid.GridPanel({
ddGroup : 'firstGridDdGroup',// GRID ddGroup
store       : secondGridStore,
enableDragDrop : true,//True GridPanel
……
});

// GRID ddGroup
var firstGridDropTargetEl = firstGrid.getView().el.dom.childNodes[0].childNodes[1];
var firstGridDropTarget = new Ext.dd.DropTarget(firstGridDropTargetEl, {
ddGroup    : 'firstGridDdGroup',// GRID ddGroup
copy        : true,
notifyDrop : function(ddSource, e, data){
   function addRow(record, index, allItems) {
    var foundItem = secondGridStore.find('name', record.data.name);
    if (foundItem == -1) {
     firstGridStore.add(record);
     firstGridStore.sort('name', 'ASC');
     ddSource.grid.store.remove(record);
    }
   }
   Ext.each(ddSource.dragData.selections ,addRow);
   return(true);
}
)};

// GRID ddGroup
var secondGridDropTargetEl = secondGrid.getView().el.dom.childNodes[0].childNodes[1];
var secondGridDropTarget = new Ext.dd.DropTarget(secondGridDropTargetEl,{
ddGroup : 'secondGridDdGroup',// GRID ddGroup
copy        : true,
notifyDrop : function(ddSource, e, data){
   function addRow(record, index, allItems) {
    var foundItem = secondGridStore.find('name', record.data.name);
    if (foundItem == -1) {
     secondGridStore.add(record);
     secondGridStore.sort('name', 'ASC');
     ddSource.grid.store.remove(record);
    }
   }
   Ext.each(ddSource.dragData.selections ,addRow);
   return(true);
}
});

좋은 웹페이지 즐겨찾기