PDA

View Full Version : My DragDrop widget is so slow! why?



outersky
4 Aug 2007, 7:55 PM
For some reason, I need to show a calendar , so I draw a table with 365 days in it.
Now I need to drag one day to another, but TreePanel is so complex an example for me,
so I found another simple sample and here is my code :



var asDragDrop = function(el){
new Ext.dd.DragSource(el, {ddGroup:'CalendarDD',dragData:{date: getDateValue(el) }});
var droptarget=new Ext.dd.DropTarget(el,{ddGroup:'CalendarDD'});
droptarget.notifyDrop=function(dd, e, data){
var beginDate = data.date;
var endDate = getDateValue(el);
alert( "From: " + data.date + " To: " + endDate );
}
}

allDateEls.each(asDragDrop);

but it takes too long to render since there are 365 elements in allDateEls .
and it always alerts me with the last date of the year as the endDate,
I mean it's always "From: fromDate To: 2007-12-31" whenever where I drop.

Thanks!