kenzogetwholestore
1 Mar 2015, 11:54 AM
Hello. Im having trouble with Grid Drag&Drop (getView().scroller.dom; is undefined) when I want to put it in tab and there's no way to make it work for me. Could you explain me how should i do that?
// declare the source Grid v
var firstGrid = new Ext.grid.GridPanel({
ddGroup: 'secondGridDDGroup',
store: firstGridStore,
columns: cols,
enableDragDrop: true,
stripeRows: true,
autoExpandColumn: 'name',
title: 'First Grid'
});
var secondGridStore = new Ext.data.JsonStore({
fields: fields,
root: 'records'
});
// create the destination Grid
var secondGrid = new Ext.grid.GridPanel({
ddGroup: 'firstGridDDGroup',
store: secondGridStore,
columns: cols,
enableDragDrop: true,
stripeRows: true,
autoExpandColumn: 'name',
title: 'Second Grid'
});
//Simple 'border layout' panel to house both grids v
ar displayPanel = new Ext.Panel({
width: 650,
height: 300,
layout: 'hbox',
defaults: {
flex: 1
},
layoutConfig: {
align: 'stretch'
},
items: [firstGrid, secondGrid]
});
var tabs = new Ext.TabPanel({
renderTo: 'panel',
activeTab: 0,
width: 600,
height: 250,
plain: true,
defaults: {
autoScroll: true
},
items: [{
title: 'Normal Tab',
items: [displayPanel]
}]
});
var blankRecord = Ext.data.Record.create(fields);
// This will make sure we only drop to the view scroller element
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.add(records);
firstGrid.store.sort('name', 'ASC');
return true
}
});
// This will make sure we only drop to the view scroller element
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('name', 'ASC');
return true
}
});
});
I tried this way (http://www.sencha.com/forum/showthread.php?120125-DragDrop-problem) but it does not help.
Thanks for responds!
// declare the source Grid v
var firstGrid = new Ext.grid.GridPanel({
ddGroup: 'secondGridDDGroup',
store: firstGridStore,
columns: cols,
enableDragDrop: true,
stripeRows: true,
autoExpandColumn: 'name',
title: 'First Grid'
});
var secondGridStore = new Ext.data.JsonStore({
fields: fields,
root: 'records'
});
// create the destination Grid
var secondGrid = new Ext.grid.GridPanel({
ddGroup: 'firstGridDDGroup',
store: secondGridStore,
columns: cols,
enableDragDrop: true,
stripeRows: true,
autoExpandColumn: 'name',
title: 'Second Grid'
});
//Simple 'border layout' panel to house both grids v
ar displayPanel = new Ext.Panel({
width: 650,
height: 300,
layout: 'hbox',
defaults: {
flex: 1
},
layoutConfig: {
align: 'stretch'
},
items: [firstGrid, secondGrid]
});
var tabs = new Ext.TabPanel({
renderTo: 'panel',
activeTab: 0,
width: 600,
height: 250,
plain: true,
defaults: {
autoScroll: true
},
items: [{
title: 'Normal Tab',
items: [displayPanel]
}]
});
var blankRecord = Ext.data.Record.create(fields);
// This will make sure we only drop to the view scroller element
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.add(records);
firstGrid.store.sort('name', 'ASC');
return true
}
});
// This will make sure we only drop to the view scroller element
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('name', 'ASC');
return true
}
});
});
I tried this way (http://www.sencha.com/forum/showthread.php?120125-DragDrop-problem) but it does not help.
Thanks for responds!