View Full Version : problem with DropTarget

21 Aug 2009, 9:55 AM
I have create a two Panel, one for container Drag Element e one for Drop area.
When I execute Drag of element in Drop area, I create a new element and add this to Drop Panel. My Problem is with when I create and add new elemet, my application go to Loop, and not create a single istance of drag element but a lot number of new element. For stop this behaviour I click with mouse in other Panel( different of Drag Panel or Drop Panel).

The code of Drop Panel and event to generate new element is

var AreaCentrale = new Ext.TabPanel({
id: 'contenitoreMaster',
title: 'titolo',
contentEl: 'idGenericTitoloGriglia',
autoScroll: true,
id: 'Genericidtitolo',
listeners: {
render : function(){
var ddrowTarget = new Ext.dd.DropTarget(Ext.get('Genericidtitolo'), {
ddGroup: "mygroup",
notifyDrop : function(dd, e, data){
var selectedRecord = dd.dragData.selections[0];
var appoggio=AreaCentrale.getItem('Genericidtitolo');
var pathImg=selectedRecord.get('symbol');
var idOggetto=selectedRecord.get('id')+'_'+Math.round(Math.random()*1000);
Ext.get("idGenericTitoloGriglia").insertHtml('beforeEnd','<img id="'+idOggetto+'" src="'+pathImg+'">')
appoggio.add(new Ext.Resizable(idOggetto, {
handles: 'all',

I understand that problems depend of the "render" event. I test this code with different event(the list of API Documentation for PANEL)but I haven't good result.
I read the API DOC for D&D but I not have a idea what change this code for delete the loop....Some may suggest a possible alternative? and/or how to modify this code to work around this problem?


23 Aug 2009, 11:18 PM
the problem is "add". Cancel this the code function correctly.

23 Aug 2009, 11:29 PM
Why are you using a contentEl???? What's in that?

You can't add a Resizable!!!!!!!

How can you add stuff (Compoonents) to a Panel which uses contentEl to pull in existing HTML?

23 Aug 2009, 11:55 PM
Infact, I update the code, and delete "add". Now my code function correctly.
Learn slowly and still spend time blunders

24 Aug 2009, 12:16 AM
I'm worried that you are rendering things somewhere in your page. There are bad signs.

24 Aug 2009, 7:47 AM
I'm totally changing that code against the most recent things I've learned.
Thanks for your interest, Insert the changes as soon as I finish.