I am trying to use dojo drag and drop within an application. Although I have ran into a little problem basically when a user drops an item into a dijit pane I would like it to target the table below the dijit. I have been able to acheive this if I do the following:
day1Drop = new dojo.dnd.Target(dijitDiv.id,{accept: ["shift"]} );
// then target the dijits child (table body)
day1Drop.parent = dojo.query(".tableDropTarget tbody")[0];
However I am now trying to make it more dynamic - I was wondering if it is possible to use a variable to replace a specfic div reference in a dojo.query. Below is what I am actually trying.
dojo.query(".shiftDropper").forEach(function(thisDay){
//var currentDay = thisDay;
currentDropZone = new dijit.TitlePane({title: thisDay.id, open:false}, thisDay);
currentDropZone = new dojo.dnd.Target(thisDay.id,{accept: ["shift"]} );
currentDropZone.parent = dojo.query(thisDay+ ".tableDropTarget tbody")[0];
})
I have tried so many different variations but can not get anything to work - any help would be greatly appreciated. Below the html to accompany the code:
<div id="Day1" class="shiftDropper">
<table class="tableDropTarget" dojoType="dojo.dnd.Target" accept="shift" copyOnly="false">
<tbody></tbody>
</table>
<div id="clearButton">Clear Shifts</div>
</div>
<div id="Day2" class="shiftDropper">
<table class="tableDropTarget" dojoType="dojo.dnd.Target" accept="shift" copyOnly="false">
<tbody></tbody>
</table>
<div id="clearButton">Clear Shifts</div>
</div>
Thanks in advance