PDA

View Full Version : Drag & drop which duplicates elements



Araberen
12 Dec 2011, 3:38 AM
Hi,

I have two grids. I can only drag elements from the first one to drop them on the second one (no problem to implement that).
But I want that when dropping the element (or starting to drag it), this one stays in the first grid... and so that just a copy is added to the second grid.

How to do that?

I'm using the Ext.grid.plugin.DragDrop object.

tobiu
12 Dec 2011, 5:51 AM
did you take a look at:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.plugin.DragDrop

-> copy: Boolean

Araberen
12 Dec 2011, 9:43 AM
Yeah, I've been trying to use it...
Hereafter is what I tried and what finally works (I tried harder because you said it should/could work with the copy property ^^) :

Ext.create('Ext.grid.Panel', {
title:'User list'
store: store,
// copy:true, // doesn't work here!
viewConfig: {
// copy:true, // WORKS HERE!!!
plugins: {
// copy:true, // doesn't work here!
ptype: 'gridviewdragdrop',
pluginId: 'draguser',
ddGroup: 'userListDDGroup',
dragGroup: 'userListDDGroup',
dropGroup: 'groupUserDDGroup',
enableDrop:false
}
}
// other stuff
});

The key has been to understand that: "It creates a specialized instance of DragZone which knows how to drag out of a GridView" (DragDrop API doc) +
"The grid View class provides extra Ext.grid.Panel specific functionality to the Ext.view.Table. In general, this class is not instanced directly, instead a viewConfig option is passed to the grid" (Ext.grid.View API doc).

So now I know how to use all the special DragDrop properties. :)

amanind
7 Jan 2012, 5:56 AM
I am implementing drag and drop functionality in singe grid, but it is not working. Can anyone let me know what is wrong I am doing.
Here is my code



Ext.define('AS.view.task.TaskListView', {
extend: 'Ext.grid.Panel',
alias: 'widget.tasklist',
id: 'organizationTasks',
selType: 'cellmodel',
store: 'TaskRootStore',
autoHeight: true,

viewConfig: {
copy: true,
stripeRows: false,
getRowClass: function (row, index) {
var data = row.data;
return data.HighlightClass;
},
plugins: {
ptype: 'gridviewdragdrop',
dragText: 'Drag and drop to reorganize'
}
},

plugins: [
Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 2 })
]
........

});

Araberen
7 Jan 2012, 10:12 AM
Please create a new topic for your question.