akottr / dragtable

re-order table columns by using drag'n'drop
http://akottr.github.io/dragtable
MIT License
203 stars 166 forks source link

Clicking on link inside draggable element (<th>) #41

Open mirrorps opened 9 years ago

mirrorps commented 9 years ago

Hi @akottr ,

Is there any way to preserve link clicking on the head section of the draggable table? As far as I can see the extension creates a temp list on top of the table, so the link cannot be clicked?

Thanks

ninal commented 9 years ago

I had the same issue, and solved it by adding a small delay to the dragtable drag. This way if an element within the <th has a click event the click event will occur before the drag starts. Set property: clickDelay: 200 in the dragtable initialization.

ggmoriyon commented 9 years ago

Thanks @ninal for your workaround: it works also in the case you need to sort the columns ascending/descending by clicking into the table-head but without adding a handle as suggested on the 'Use a handle to drag'n'drop the columns' example.

akindemirci commented 6 years ago

Another workaround that I found is to stop the sort link's mousedown event bubbling up the dom tree and trigger dragging, like this:

$('th > a').mousedown(function(e){
  e.stopPropagation();
})
lukasojd commented 6 years ago

+1