akottr / dragtable

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

Touch device and Contain to 3 columns #43

Open parteekgarg01 opened 9 years ago

parteekgarg01 commented 9 years ago

Hi Akottr,

Great plugin and many thanks for hard-work you have put into such a wonderful plugin. Please can you help me get this working in touch devices. I already tried using jquery touch-punch but no luck though ui-draggable works. Secondly I'm using this plugin in angularjs and I have some columns those are hidden and only 3 columns are visible at a time. Please can you help me contain drag to 3 columns only.

Thanks Parteek

brent-jenkins commented 9 years ago

I've encountered a similar issue (not with hidden columns though). It may be possible to enable draggable columns by:

  1. Disabling the default long-touch behaviour (select/copy/cut/etc) http://makandracards.com/makandra/1354-disable-text-selection-on-ios-and-android-devices
  2. Adding support for "touchstart" and "touchend" events in addition to "mousedown" and "mouseup" in jquery.dragtable.js.

If I get time, I'll take a look and see if those help.

parteekgarg01 commented 9 years ago

Thanks brentj73 for reply and all the help. I will try the options advised by you.

Thanks Parteek

brent-jenkins commented 9 years ago

I took a look at the code but I thought there was too much to go through for the time that I had available. I've created an updated version based solely on JQuery at https://github.com/brentj73/jsdragtable (there's a jsfiddle at https://jsfiddle.net/brentj73/hs2n71mo/ as well).

This seems to work on touch devices. Perhaps some of the code can be brought back into this project?