PDA

View Full Version : Grid Drag and Drop events



jsakalos
5 May 2007, 11:19 AM
I have just found that there are no DnD events (e.g. startdrag) in the current Ext version (1.0.1a).

My question is: Jack, is there a plan to put them back in next version? Should I wait or should I find my solution?

http://extjs.com/forum/showthread.php?t=5211


Just to explain why I need it: I need to intercept startdrag event, among other reasons, because I want to change the DD ghost content from "xy selected rows" to the data from let's say first column of dragged row to show e.g. Company name.

jack.slocum
5 May 2007, 2:34 PM
Yes, we will be putting in the new DD events soon. For what you want though, there is a function "getDragDropText " you can implement. Here's what I am using in XTrack:


grid.getDragDropText = function(){
var s = sm.getSelections();
if(s.length == 1){
return String.format('<b>Drag Ticket #{0} to your Watch List<b>', s[0].data.ticket);
}else{
var tickets = [];
for(var i = 0, len = s.length; i < len; i++){
tickets.push('#' + s[i].data.ticket);
}
return String.format(
'<b>Drag the {0} selected tickets to your Watch List</b><br />{1}',
s.length, tickets.join(', '));
}
};

jsakalos
5 May 2007, 4:19 PM
Thanks Jack,

that's valuable info so I'm not going to reinvent the wheel. ;) Still a lot of work in another areas of my project...

What about a rough roadmap what I (and maybe others too) am begging for?

JasonMichael
16 May 2007, 8:32 AM
I can't seem to get scriptaculous to work well with extjs in the meantime... *sigh*. really just want to have a draggable div (no target droppable... just something real simple)........:-/

JasonMichael
16 May 2007, 9:01 AM
Nevermind, I figured it out. I was going down the path of darkness trying to get scriptaculous to work - I decided to save myself some agony and do this:


var ddEl = new Ext.dd.DDProxy(Ext.get("specialbox") );

One line of code above works great.

So for those of you searching on drag and drop, or dragdrop, ext.dd, if all you want to do is something as simple as having a nice draggable object, use this code and save yourself some time.