今天在ext中实现两个grid之间拖拽数据,报getView().scroller.dom为空或者不是对象的错误,解决办法是把代码
var blankRecord = Ext.data.Record.create(yfield);
var firstGridDropTargetEl = firstGrid.getView().scroller.dom;
var firstGridDropTarget = new Ext.dd.DropTarget(firstGridDropTargetEl,
{
ddGroup : 'firstGridDDGroup',
notifyDrop : function(ddSource, e, data) {
var records = ddSource.dragData.selections;
Ext.each(records, ddSource.grid.store.remove,
ddSource.grid.store);
firstGrid.store.sort('userName', 'ASC');
return true;
}
});
var secondGridDropTargetEl = secondGrid.getView().scroller.dom;
var secondGridDropTarget = new Ext.dd.DropTarget(
secondGridDropTargetEl, {
ddGroup : 'secondGridDDGroup',
notifyDrop : function(ddSource, e, data) {
var records = ddSource.dragData.selections;
Ext.each(records, ddSource.grid.store.remove,
ddSource.grid.store);
secondGrid.store.add(records);
secondGrid.store.sort('userName', 'ASC');
return true;
}
});
把这段代码放到wWindow.show();之后就可以了
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25261409/viewspace-1049389/ ,如需转载,请注明出处,否则将追究法律责任。