Extjs Drag & Drop between two grid
i need to drag from grlRicProd to drop into grlInsOrd
grlIRicProd: .....
id: 'grlRicProd',
sm: new Ext.grid.RowSelectionModel({
singleSelect: false
}),
enableDragDrop: true, ddGroup: 'grlRicProd-dd',
ddText: 'Prodotto Selezionato',
......
grlInsOrd
....id: 'grlInsOrd',
enableDragDrop:
true, ddGroup: 'grlInsOrd-dd',
listeners: {
"render": {
fn: function(grid) {
var ddrow = new Ext.dd.DropTarget(Ext.getCmp('grlInsOrd').getEl(), {
ddGroup: 'grlRicProd-dd', // Data come from??
copy: false,
notifyDrop: function(dd, e, data) {
var sm = Ext.getCmp('grlRicProd').getSelectionModel();
var rows = sm.getSelections();
var cindex = dd.getDragData(e).rowIndex; //cindex IS UNDEFINED! WHY?
if (sm.hasSelection()) {
for (i = 0; i < rows.length; i++) {
Ext.getCmp('grlRicProd').store.remove(Ext.getCmp('grlRicProd').store.getById(rows[i].id)); //THIS WORKS FINE
Ext.getCmp('grlInsOrd').insert(cindex,rows[i]);//ERROR cindex is not开发者_Python百科 defined
}
sm.selectRecords(rows);
}
});
}
} }
how can i solve it?? thanks!
See this example and its code:
http://dev.sencha.com/deploy/ext-4.0.2a/examples/dd/dnd_grid_to_grid.html
It works perfectly! You are doing something which isnt required. the copy, creation and removal is all done automatically.
精彩评论