views:

57

answers:

1

Hi,

I'm building a seating application using jQuery. I have tables with chairs around them, which may have guests seated at the chairs. Each table has a wrapper div which is draggable. Inside the table are any number of chair div's. Inside any chair div a guest may be seated. Guest are also a div which is nested inside the chair div. Here is a sample for the markup of one such table. This table has 8 chiars with two guests seated at the first two chairs.

<div id="table-wrapper-1" class="table-wrapper table-type-0 ui-draggable">  
  <div id="table-1" class="seating-table">    
    <div class="seating-table-name">Table 1</div>  
  </div>
  <div id="chair-1-0" class="chair chair-pos-0 table-chair-1">
    <div title="Elaine Benis" id="guest-2-5-2" class="guest guest-2 ui-draggable"></div>
  </div>
  <div id="chair-1-1" class="chair chair-pos-1 table-chair-1">
    <div title="Elaine Benis" id="guest-2-5-2" class="guest guest-2 ui-draggable"></div>
  </div>
  <div id="chair-1-2" class="chair chair-pos-2 table-chair-1"></div>
  <div id="chair-1-3" class="chair chair-pos-3 table-chair-1"></div>
  <div id="chair-1-4" class="chair chair-pos-4 table-chair-1"></div>
  <div id="chair-1-5" class="chair chair-pos-5 table-chair-1"></div>
  <div id="chair-1-6" class="chair chair-pos-6 table-chair-1"></div>
  <div id="chair-1-7" class="chair chair-pos-7 table-chair-1"></div>
</div>

The div.table-wrapper is a draggable and so are the div.guest's. The idea is that you can drag a guest from one chair to another, or drag the entire table to a different location. The problem I am having is in IE, where if you click and drag a guest, both the guest and the table drag at the same time. Does anyone know how I can fix that?

Thanks, ~Matt

+1  A: 

After a lot of digging, I seem to have found a solution for now. It involves hacking ui.draggable.js, but currently it doesn't look like there is any other way.

To see my full answer, have a look at my post on the jQuery forum:

http://forum.jquery.com/topic/draggable-nested-inside-draggable-drags-both-when-dragging-child-in-ie

Hope this helps someone with a similar issue.

Thanks, ~Matt

m4olivei
+1 Perfect, just hit the same problem. I'm using 'sortable' to implement "portlets" that the user can arrange (as in one of the standard demos), and then I want some draggable elements within some of the portlets.
Daniel Earwicker