[Dojo-interest] simple drag and drop in 0.9

Jeremy Quinn jeremy at apache.org
Wed Apr 2 13:21:28 UTC 2008

Dear All

I also find myself struggling to update some custom DND code from Dojo  
0.4.n in the Repeater Widget from Apache Cocoon CForms block.

I am initially trying to do this without resorting to extending the  
DND classes.

One problem I am trying to solve is keeping the state of a checkbox in  
each dojoDndItem in sync with the selection state of the dojoDndItem  
(we need to persist the selection state). Checking/unchecking the  
checkbox and clicking/dragging the dojoDndItem should both be able to  
effect each other.
This is made more difficult by having no API for setting or reading  
the selection state on a dojoDndItem or being notified when it  
changes, meaning I am having to call private functions etc. from a  
custom onMouseUp handler called after the one on dojo.dnd.Selector. It  
just about works, though there must be a better way (is there?).

The next Issue I have to face is control over copy-or-move operations.
A CForms Repeater should only allow move operations within a single  
Source and copy operations while transferring between multiple Sources.
We were able to control this in the past by connecting to the relevant  
event using 'before' advice, however this has been removed from Dojo  
1.1. I cannot see how to modify or cancel in-progress DND operations.

How did the developers envisage these kinds of modifications to DND  
behaviour should be applied?

Thanks for any suggestions

regards Jeremy

On 25 Mar 2008, at 04:00, Eugene Lazutkin wrote:

> In short: yes, it is possible --- the creator function can do anything
> (including nothing) as soon as it returns a required triplet. Look in
> the documentation for more details:
> http://docs.google.com/Doc?id=d764479_11fcs7s397. Specifically read  
> how
> the default creator is implemented.
> Thanks,
> Eugene
> Luke Arms wrote:
>> Hi,
>> So I'm trying to port Dojo 0.4.3 drag and drop code to 0.9 (well, 1.0
>> actually), and having endless difficulty with it.
>> I have extensive code that looks after the widgets I'm dragging and
>> dropping, on top of which I simply create DnD sources and targets  
>> based on
>> specific nodes in those widgets.
>> It seems that the new DnD API requires data-based node creators and
>> what-not, none of which I want to re-engineer everything else  
>> around. How
>> can I simply allow widgets to be click and draggable with the new- 
>> fangled
>> business?
>> Is it possible for a node creator function to simply return a pre- 
>> existing
>> node?
>> Hopefully someone can help!
>> Cheers,
>> Luke
>> PS: In every other respect, I'm LOVING how tidy the Dojo 1.0 code  
>> base is.
>> Really awesome work.

More information about the Dojo-interest mailing list