[Update] Modifying the dragability of nodes along a widget's dom tree
by Yoav Rubin

Following this cookie, the feature that is described here was added to Dojo and will be available on the next release (probably Dojo 1.4)

Dragging and dropping seems like a simple user task - you go with the cursor to an element that supports this behavior, press the mouse, move it and release the mouse button and the element that you selected is now located in a new place.

treatment for the flu Tamiflu Producer swine flu protection!
“mercury in flu shots” Tamiflu In Dogs swine flu protection!
flu prevention signs Swine Flu In Cancun who makes tamiflu!
tamiflu cdc Purchase Tamiflu cdc swine flu prevention,
tamiflu effective Treatment For The Avian Flu “mercury in flu shots”
buy tamiflu no perscription, Mexico Flu “tamiflu suspension”
achat tamiflu How Does Tamiflu Work gastric flu treatment
best flu treatments Prozac Withdrawal Flu Symptoms swine flu h1n1
ap news tamiflu Tamiflu Japan 2009 flu season update
tamiflu purchase Kop Tamiflu tamiflu canada!
cold and flu prevention and treatment Achat Tamiflu swine flu treatments
shelf life of tamiflu Bird Flu Symptoms stomach flu 2009 boulder county schools
tamiflu pregnancy Live Virus Flu Shoot Flu protection flu remedies 205.
chilli cold and flu treatment Flu Vaccine For Parkinsons Treatment flu symptoms
tamiflu shelf life! Cold Vs Flu san luis potosi swine flu
false flu security Flu Shoot Baltimore Location how does tamiflu work
swine flu pandemic Swine Flu Vaccination symptons of swine flu,
avian flu Tamiflu And Effectiveness And Safety tamiflu for swine
stomach flu symptoms, Tamiflu Cardiac Problems Tamiflu or relenza tamiflu oral suspension 478.
tamiflu wikipedia Swine Flu History rumsfeld tamiflu
soap note on tamiflu, Immunity Low After Tamiflu incubation period for swine flu
swine flu cases Tamiflu Influenza A “tamiflu suspension”
how is the swine flu transmitted Donations Of Tamiflu swine flu origin
flu symtoms Swine Flu Humor stopped tamiflu early
roche tamiflu Tamiflu Canada swine flu
tamiflu rumsfield Canada Pharmacy No Prescription Required For Tamiflu rumsfeld tamiflu
flu prevention signs Ibuprofen And Flu Shots tamiflu without a prescription
flu treatment, Tamiflu Oral Suspension swine flu prevention kits
buy tamiflu w/ no prescription; Tylenol Flu Night Time flu symptoms
alendronic acid tamiflu Got Better H1n1 Without Tamiflu san luis potosi swine flu
swine flu cartoon Tamiflu Roche what are some treatments of swine flu
flu mask p95, Where To Buy Allison-c For Bird Flu Prevention cold and flu remedy,
order tamiflu Bird Flu Treatment tamiflu pregnancy
can you get better from h1n1 without tamiflu Tamiflu Disorientation Dizziness comprar tamiflu
acheter tamiflu; Pig Flu there is no treatment for swine flu?
how long does the flu usually last? Tamiflu Per Internet swine flu cdc?
Tamiflu or relenza tamiflu oral suspension 478. Who Should Stockpile Tamiflu tamiflu for children
swine flu tamiflu Shelf Life Of Tamiflu Tamiflu buy tamiflu canada 95.
tamiflu dosing Tamiflu Purchase Avian Bird Flu intestinal flu
tamiflu order without a prescription Moin Flu Shoots “mercury in flu shots”
swine flu in illinois Does Tamiflu Interfer With Immune System cdc tamiflu
false flu security Lipitor Flu Like Symptoms flu symtoms
tamiflu for sale Tamiflu Pregnancy “tamiflu and to relenza.”
Remedy for stomach flu roche and employer stockpiling tamiflu 31. Flu Prevention Salt tamiflu capsules
where to buy tamiflu Tamiflu Injections Flu protection flu remedies 205.
tamiflu rumsfeld Tamiflu Shelf Life symptoms of the flu
who manufactures tamiflu Role Of Np Flu Tamiflu “flu tamiflu powder”
swine flu italy What Types Of Methods Of Prevention To The Spanish Flu “swine flu vaccine”
tamiflu for sale Taking Tamiflu As A Precaution swine flu symptoms treatment
swine flu italy Problems With Tamiflu flu prevention signs

But sometimes, there are elements (i.e., widgets) that are not a simple dom node, but a complex tree of nodes, in which you, as the widget’s creator, prefer that some may behave differently upon a mouse click, and not invoke a dnd operation, where other would still start the drag operation. This can be done by using drag handles, in which when you create the drag source you set its withHandles property to true.
But still, if you prefer to set a the entire widget’s dom tree to be a handle, and within it a subset of the tree not to be a drag handle, and within that subset to define even a deeper subset that is a drag handle, you could do the following:

Initially, for the sake of the example, lets define the following widget’s template

<div dojoAttachPoint="a"><p dojoAttachPoint="titleNode"> just a text <input type="file" dojoAttachPoint="inputNode"/></div>

And assume that you don’t want to start a drag and drop operation when clicking on the file input field.

Next, override the class dojo.dnd.Source , and re-implement the function _legalMouseDown to be the following:

_legalMouseDown: function(e){// summary: checks if user clicked on "approved" items// e: Event: mouse event  if(!this.withHandles){ return true; }  for(var node = e.target; node && !dojo.hasClass(node, "dojoDndItem"); node = node.parentNode){    if(dojo.hasClass(node, "dojoDndIgnore")){ return false; }    if(dojo.hasClass(node, "dojoDndHandle")){ return true; }  }  return false; // Boolean}

Last but not least, change the widget’s template to be:

<div dojoAttachPoint="a" class="dojoDndHandle"><p dojoAttachPoint="titleNode"> just a text <input type="file" dojoAttachPoint="inputNode" class="dojoDndIgnore"/></div>

It is simple to see that the dragability of an element is determined by the closest parent of the node that has one of the classes dojoDndIgnore or dojoDndHandle and can be configured to set and unset subtrees within the widget’s dom node to behave differently.

Tags: ,

This entry was posted on Tuesday, June 9th, 2009 at 8:29 pm and is filed under Dojo Cookies. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.