Saravananscope / dragtable

Automatically exported from code.google.com/p/dragtable
0 stars 0 forks source link

What about dragging rows #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This project is really great!  I wish I better understood JavaScript, but I
don't have time to learn it.

What I am wondering is whether or not you could (and would) be able to
easily add sorting rows.  I have a specific use case in mind that would
benefit from this greatly.  I have a table of tasks that currently needs to
be implemented as DIVs in order to get drag/drop behavior.  When a task is
dragged from one position to another an event is triggered back on the
server that reprioritizes the tasks.  If I could implement that as a TABLE
it would make other things about the set of tasks a lot easier (like lining
up headers, being able to use sorttable and filtertable, etc.).

Thanks.

Original issue reported on code.google.com by jacaete...@gmail.com on 27 Jun 2008 at 6:33

GoogleCodeExporter commented 8 years ago
Sorry, I entered this as a defect.  It's clearly NOT a defect.

Original comment by jacaete...@gmail.com on 27 Jun 2008 at 6:34

GoogleCodeExporter commented 8 years ago

Original comment by danvdk on 30 Jun 2009 at 7:12

GoogleCodeExporter commented 8 years ago
try this jquery plugin 
http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/

Original comment by maxstrue...@gmail.com on 30 Jun 2009 at 8:24

GoogleCodeExporter commented 8 years ago
Is it possible to modify this existing code to handle rows? This seems one of 
the
most light-weight code for dragging-dropping items.

Original comment by silico...@gmail.com on 11 Sep 2009 at 11:57

GoogleCodeExporter commented 8 years ago
Hi maxstruever,

Just FYI - I did have a look at the link you mentioned above, but it seems 
overkill
to use a 55kb framework for a simple functionality. I'm trying to tweak the 
code so
it works on rows instead of columns, but it doesn't seem to work right now.

Original comment by silico...@gmail.com on 12 Sep 2009 at 1:58

GoogleCodeExporter commented 8 years ago
Hmmm - I attempted an extensive modification of the code in order to get it to 
work
with rows, but I ran into a Javascript limitation. There appears to be no way of
addressing the columns element like we address the rows.

See function makeDraggable(). There appears to be no equivalent of 
table.rows[0] for
columns.

// The thead business is taken straight from sorttable.
  makeDraggable: function(table) {
    if (table.getElementsByTagName('thead').length == 0) {
      the = document.createElement('thead');
      the.appendChild(table.rows[0]);
      table.insertBefore(the,table.firstChild);
    }

PS: I have no idea of what I'm doing. I was trying to replace (manually) all
references to rows to columns, and vice-versa, but ran into this problem above. 

Original comment by silico...@gmail.com on 12 Sep 2009 at 3:05

GoogleCodeExporter commented 8 years ago
I'm guessing you can just use the DOM structure to get a single row. Tables are 
defined in row-major order (like 
<table><tr><td>..., not <table><td><tr>), so the TR element should contain all 
the columns for a row.

Original comment by danvdk on 13 Sep 2009 at 4:35