PDA

View Full Version : Drag From DataView and Drop in Panel EXTJS 4



santho89
29 Oct 2012, 2:27 AM
I am creating a drag and drop where i have a dataview with a set of images. Then i have a panel where i want to let the user drop the images from the dataview. Using the examples in the sencha examples i was able to get something like this. But i am getting an error

Uncaught TypeError: Cannot set property 'afterValidDrop' of undefined
This is what i have in my panel.


Ext.define('Memegen.view.MemeBuildArea',{ extend: 'Ext.panel.Panel', alias: 'widget.memebuildarea', listeners: { render: initializeMemeDropZone }, cls: 'meme-target',});function initializeMemeDropZone(targetPanel) { targetPanel.dropTarget = Ext.create('Ext.dd.DropTarget', targetPanel.el); targetPanel.dropTarget.notifyDrop = function(source, evt, data) { if(typeof console != "undefined") console.log("notifyDrop:" + source.id); var droppedPanel = Ext.getCmp(source.id); droppedPanel.dd.afterValidDrop = function() { targetPanel.add(droppedPanel.cloneConfig({ draggable: false, title: "Can't Drag This Panel." })); droppedPanel.destroy(); }; return true;} targetPanel.dropTarget.notifyEnter = function(source, evt, data) { if(typeof console != "undefined") console.log("notifyEnter:" + source.id); return this.callParent(Array.prototype.slice.call(arguments)); }; targetPanel.dropTarget.notifyOut = function(source, evt, data) { if(typeof console != "undefined") console.log("notifyOut:" + source.id); return this.callParent(Array.prototype.slice.call(arguments)); }; targetPanel.dropTarget.notifyOver = function(source, evt, data) { if(typeof console != "undefined") console.log("notifyOver:" + source.id); return this.callParent(Array.prototype.slice.call(arguments)); };}

mitchellsimoens
1 Nov 2012, 7:05 AM
I cannot read your code. Please use BBCode code tags and make sure the code is still formatted

ksin11
18 Jul 2013, 11:09 PM
Sir i need Draggable images with 1st image i dropped in 3rd place then it should change the place as third image will shift to 2 place n 2nd to 1st place.Eg:http://tof2k.com/ext/sortable/ Plz i need the full project in sencha touch Thanx in Advance