473,614 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table - Columns drag & drop

54 New Member
I´ve seen some people around the web wondering about a code to reorder table columns using the mouse (drag and drop). Since i had already made one script to reorder table lines (TR´s) i decided to start working in one to reorder the columns. Im sharing this code with you all now. If anyone find any issue needing improvements just email-me and i will try to fix. The implementation is very easy, only change the ID of the table in the tabelaDrag variable and it should work.

ps:english is not my primary language so... :)

file: movecolumns.css

Expand|Select|Wrap|Line Numbers
  1. /* estilo geral da tabela */
  2. table {border-collapse:collapse}
  3. table td {border:1px solid #000; padding:2px 5px; text-align:center; cursor:pointer}
  4.  
  5. /* classe das cores utilizadas na movimentação */
  6. .hover {background:lightblue}
  7. .selecionado {background:lightgreen}
  8.  
file:movecolumn s.js

Expand|Select|Wrap|Line Numbers
  1. //----------------------------------------------//
  2. //    Created by: Romulo do Nascimento Ferreira    //
  3. //    Email: romulo.nf@gmail.com                    //
  4. //----------------------------------------------//
  5.  
  6. // NOTICE: This code may be use dto any purpose without further
  7. // permission from the author. You may remove this notice from the
  8. // final code, however its appreciated if you keep the author name/email.
  9. // Email me if theres something needing improvement
  10.  
  11. //set the id of the table that is gonna have the 
  12. //moving column function in the tabelaDrag variable
  13. document.onmouseup = soltar;
  14. var drag = false;
  15.  
  16. window.onload = init
  17.  
  18. function init() {
  19. tabelaDrag = document.getElementById("tabela");
  20. linhas = tabelaDrag.getElementsByTagName("TR");
  21. celulas = tabelaDrag.getElementsByTagName("TD");
  22. linhaUm = tabelaDrag.rows[0]
  23. ordenacaoMaxima = linhaUm.cells.length
  24.  
  25.   tabelaDrag.onselectstart = function () { return false; } 
  26.   tabelaDrag.onmousedown = function () { return false; }
  27.  
  28.       for (x=0; x<celulas.length;x++) {
  29.         arrastar(celulas[x])
  30.         celulas[x].onmouseover = pintar
  31.         celulas[x].onmouseout = pintar
  32.     }
  33. }
  34.  
  35. function capturarColuna(obj) {
  36. coluna = obj.cellIndex
  37. return coluna
  38. }
  39.  
  40. function orderTd (obj) {
  41. destino = obj.cellIndex
  42.  
  43. if (destino == null) return
  44. if (coluna == destino) return
  45.  
  46.     for (x=0; x<linhas.length; x++) {
  47.     tds = linhas[x].cells
  48.     var celula = linhas[x].removeChild(tds[coluna])
  49.         if (destino >= ordenacaoMaxima || destino + 1 >= ordenacaoMaxima) {
  50.         linhas[x].appendChild(celula)
  51.         }
  52.         else {
  53.         linhas[x].insertBefore(celula, tds[destino])
  54.         }
  55.     }
  56. }
  57.  
  58. function soltar(e){
  59.     if (!e) e=window.event
  60.     if (e.target) targ = e.target
  61.     else if (e.srcElement) targ=e.srcElement
  62.     orderTd(targ)
  63.     drag = false
  64.  
  65.     for(x=0; x<linhas.length; x++) {
  66.         for (y=0; y<linhas[x].cells.length; y++) {
  67.         linhas[x].cells[y].className="";
  68.         }
  69.     }
  70. }
  71.  
  72. function arrastar(obj){
  73.     if(!obj) return;
  74.     obj.onmousedown = function(ev){
  75.         colunaAtual = this.cellIndex
  76.             for (x=0; x<linhas.length; x++) {
  77.             linhas[x].cells[this.cellIndex].className="selecionado"
  78.             }
  79.         drag = true
  80.         capturarColuna(this);
  81.         return false;
  82.     }
  83. }
  84.  
  85. function pintar(e) {
  86. if (!e) e=window.event
  87. ev = e.type
  88.  
  89.     if (ev == "mouseover") {
  90.         if (drag) {
  91.             for (x=0; x<linhas.length; x++) {
  92.                 if (this.className !="selecionado") {
  93.                 linhas[x].cells[this.cellIndex].className="hover"
  94.                 }
  95.             }
  96.         }
  97.     }
  98.  
  99.     else if (ev == "mouseout") {
  100.         for (x=0; x<linhas.length; x++) {
  101.             if (this.className !="selecionado") {
  102.             linhas[x].cells[this.cellIndex].className=""
  103.             }
  104.         }
  105.     }
  106. }
  107.  
  108.  
file:movecolumn s.html

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2.  
  3. <html>
  4. <head>
  5.     <title>Drag and Drop Columns</title>
  6.  
  7. <script type="text/javascript" src="movecolumn.js"></script>
  8.  
  9. <link rel="StyleSheet" href="movecolumn.css" type="text/css" />
  10.  
  11. </head>
  12.  
  13. <body>
  14.  
  15. <table id="tabela">
  16.     <tr>
  17.         <td>Coluna 1</td>
  18.         <td>Coluna 2</td>
  19.         <td>Coluna 3</td>
  20.         <td>Coluna 4</td>
  21.         <td>Coluna 5</td>
  22.         <td>Coluna 6</td>
  23.         <td>Coluna 7</td>
  24.         <td>Coluna 8</td>
  25.         <td>Coluna 9</td>
  26.         <td>Coluna 10</td>
  27.     </tr>
  28.     <tr>
  29.         <td>A1</td>
  30.         <td>A2</td>
  31.         <td>A3</td>
  32.         <td>A4</td>
  33.         <td>A5</td>
  34.         <td>A6</td>
  35.         <td>A7</td>
  36.         <td>A8</td>
  37.         <td>A9</td>
  38.         <td>A10</td>
  39.     </tr>
  40.     <tr>
  41.         <td>B1</td>
  42.         <td>B2</td>
  43.         <td>B3</td>
  44.         <td>B4</td>
  45.         <td>B5</td>
  46.         <td>B6</td>
  47.         <td>B7</td>
  48.         <td>B8</td>
  49.         <td>B9</td>
  50.         <td>B10</td>
  51.     </tr>
  52.     <tr>
  53.         <td>C1</td>
  54.         <td>C2</td>
  55.         <td>C3</td>
  56.         <td>C4</td>
  57.         <td>C5</td>
  58.         <td>C6</td>
  59.         <td>C7</td>
  60.         <td>C8</td>
  61.         <td>C9</td>
  62.         <td>C10</td>
  63.     </tr>
  64.  
  65. </table>
  66.  
  67. </body>
  68.  
  69. </html>
  70.  
Nov 1 '06 #1
17 31622
abducted
8 New Member
Tested for macintosh:

Works in Firefox 1.5.0.6 for mac.
Works in Opera 9.01 for mac.
Does not work in Safari 2.0.4.

It's pretty nice, and simple. I might take a crack at debugging Safari and posting the results.
Dec 10 '06 #2
archrajan
2 New Member
Great code.
But can you enhance it so that when a column is dragged(the selected column), it is visible when you hover over a different column.
Dec 12 '06 #3
Romulo NF
54 New Member
Great code.
But can you enhance it so that when a column is dragged(the selected column), it is visible when you hover over a different column.
The code is actually just using some css to change colors. The selected column becomes green while the mouse is pressed and the place where it will drop is blue.

I think you are talking about making the whole column to be "floating" with the mouse cursor. To do that we need a function to get the mouse coords and make the element that we click and drag to use position:absolu te and to follow these coords. The functionality will be the same in end.

An example of that function to move the elements:
Drag & Drop Example

ps: im supposing i can post that link here, sorry if i don´t!
Dec 13 '06 #4
chillAtGVC
1 New Member
The problem is that Safari does not (correctly) implement td.cellIndex. It always returns zero. Lame.

Change all foo.cellIndex to cellIndex(foo) and add these two methods:

Expand|Select|Wrap|Line Numbers
  1. function cellIndex(td) {
  2.     var ci = -1;
  3.     var parent_row = ascendDOM(td, 'tr');
  4.     for (var i = 0; i < parent_row.cells.length; i++) {
  5.         if (td === parent_row.cells[i]) {
  6.             ci = i;
  7.         }
  8.     }
  9.     return ci;
  10. }
  11.  
  12. function ascendDOM(e,target) {
  13.     while (e.nodeName.toLowerCase() !=target &&
  14.            e.nodeName.toLowerCase() !='html')
  15.         e=e.parentNode;
  16.     return (e.nodeName.toLowerCase() == 'html')? null : e;
  17. }
Feb 2 '07 #5
abducted
8 New Member
Thanks for the fix.
Feb 2 '07 #6
cdtkoenig
2 New Member
Here is a custom version, which highlight selected column to move, show insertion point as a vertical line (left cells border style update) during column drag (like firefox tab drag&drop) and keep original table styles. Seems to work on my stuff, hope it will help ;)

Expand|Select|Wrap|Line Numbers
  1. //----------------------------------------------//
  2. //    Created by: Romulo do Nascimento Ferreira    //
  3. //    Email: romulo.nf@gmail.com                    //
  4. //----------------------------------------------//
  5.  
  6. // NOTICE: This code may be use dto any purpose without further
  7. // permission from the author. You may remove this notice from the
  8. // final code, however its appreciated if you keep the author name/email.
  9. // Email me if theres something needing improvement
  10.  
  11.  
  12. var drag = false;
  13. var colOrder=[];
  14. var borderLeftStyle=[];
  15. var borderLeftColor=[];
  16. var cellBackgroundColor=[];
  17. var borderLeftWidth=[];
  18. var colNames=[];
  19.  
  20. function setTableColMovable(tableName,ColOrderFieldName,colNames) {
  21.   tabelaDrag = document.getElementById(tableName);
  22.   ColOrderField = document.getElementById(ColOrderFieldName);
  23.   linhas = tabelaDrag.getElementsByTagName("TR");
  24.   celulas = tabelaDrag.getElementsByTagName("TD");
  25.   linhaUm = tabelaDrag.rows[0]
  26.   ordenacaoMaxima = linhaUm.cells.length
  27.  
  28.   //store columns order
  29.   for (x=0;x<linhaUm.cells.length;x++) 
  30.     {
  31.       arrastar(celulas[x]);
  32.       celulas[x].onselectstart = function () { return false; } //prevent text selection
  33.       celulas[x].onmouseover = pintar
  34.       celulas[x].onmouseout = pintar
  35.       celulas[x].onmouseup = pintar
  36.     colOrder[x]=colNames[x];
  37.     linhaUm.cells[x].style.cursor="pointer";
  38.     }
  39.  
  40.     //store cells styles
  41.     for(x=0; x<linhas.length; x++) {
  42.       borderLeftStyle[x]=[];
  43.       borderLeftColor[x]=[];    
  44.       cellBackgroundColor[x]=[];
  45.       borderLeftWidth[x]=[];    
  46.         for (y=0; y<linhas[x].cells.length; y++) {
  47.          borderLeftStyle[x][y]=linhas[x].cells[y].style.borderLeftStyle;
  48.          borderLeftColor[x][y]=linhas[x].cells[y].style.borderLeftColor;
  49.          cellBackgroundColor[x][y]=linhas[x].cells[y].style.backgroundColor;
  50.          borderLeftWidth[x][y]=linhas[x].cells[y].style.borderLeftWidth;
  51.          }
  52.     }
  53.   }
  54.  
  55. function getColOrder()
  56.   {
  57.   return colOrder
  58.   }
  59.  
  60. function moveArrayCol(myArray,source,destination)
  61.   {
  62.   val=myArray.splice(source,1);
  63.   if (source < destination)
  64.     {myArray.splice(destination-1,0,val);}
  65.   else
  66.     {myArray.splice(destination,0,val);}
  67.   return myArray
  68.   }
  69.  
  70. function capturarColuna(obj) {
  71.   coluna = cellIndex(obj)
  72. return coluna
  73. }
  74.  
  75. function orderTd (obj) {
  76.   destino = cellIndex(obj)
  77.   if (destino == null) return
  78.   if (coluna == destino) return
  79.  
  80.   for (x=0; x<linhas.length; x++) 
  81.     {
  82.       tds = linhas[x].cells
  83.       var celula = linhas[x].removeChild(tds[coluna])
  84.           if (coluna < destino) 
  85.         {
  86.             linhas[x].insertBefore(celula, tds[destino-1])
  87.             }
  88.           else 
  89.         {
  90.             linhas[x].insertBefore(celula, tds[destino])
  91.             }
  92.       }
  93.   moveArrayCol(colOrder,coluna,destino);
  94.   //alert(colOrder);
  95. }
  96.  
  97. function soltar(e){
  98.     if (!e) e=window.event
  99.     if (e.target) targ = e.target
  100.     else if (e.srcElement) targ=e.srcElement
  101.     orderTd(targ)
  102.     drag = false
  103.  
  104.     for(x=0; x<linhas.length; x++) {
  105.         for (y=0; y<linhas[x].cells.length; y++) {
  106.         linhas[x].cells[y].style.borderLeftStyle=borderLeftStyle[x][y];
  107.         linhas[x].cells[y].style.borderLeftColor=borderLeftColor[x][y];
  108.         linhas[x].cells[y].style.backgroundColor=cellBackgroundColor[x][y];
  109.         linhas[x].cells[y].style.borderLeftWidth=borderLeftWidth[x][y];
  110.         }
  111.     }
  112. }
  113.  
  114. function arrastar(obj){
  115.     if(!obj) return;
  116.     obj.onmousedown = function(ev){
  117.         //colunaAtual = cellIndex(this))
  118.             for (x=0; x<linhas.length; x++) {
  119.             linhas[x].cells[cellIndex(this)].style.backgroundColor="yellow"
  120.             }
  121.         drag = true
  122.         capturarColuna(this);
  123.         return false;
  124.     }
  125. }
  126.  
  127. function pintar(e) {
  128. if (!e) e=window.event
  129. ev = e.type
  130.  
  131.     if (ev == "mouseover") {
  132.         if (drag) {
  133.             for (x=0; x<linhas.length; x++) {
  134.                 if (cellIndex(this) !=coluna) { //(this.style.borderStyle !="dashed") {
  135.                 linhas[x].cells[cellIndex(this)].style.borderLeftStyle="solid";
  136.                 linhas[x].cells[cellIndex(this)].style.borderLeftColor="red";
  137.                 linhas[x].cells[cellIndex(this)].style.borderLeftWidth="2px";
  138.                 }
  139.             }
  140.         }
  141.     }
  142.  
  143.     else if (ev == "mouseout") {
  144.             if (drag) 
  145.         {for (x=0; x<linhas.length; x++)  
  146.           {if (cellIndex(this) !=coluna) //(this.borderStyle !="dashed") 
  147.             {
  148.             linhas[x].cells[cellIndex(this)].style.borderLeftStyle=borderLeftStyle[x] [cellIndex(this)];
  149.             linhas[x].cells[cellIndex(this)].style.borderLeftColor=borderLeftColor[x] [cellIndex(this)];
  150.             linhas[x].cells[cellIndex(this)].style.backgroundColor=cellBackgroundColor[x] [cellIndex(this)];            
  151.             linhas[x].cells[cellIndex(this)].style.borderLeftWidth=borderLeftWidth[x] [cellIndex(this)];            
  152.             }
  153.           }
  154.         }
  155.   }
  156.  
  157.  
  158.     else if (ev == "mouseup") {
  159.       if (e.target) targ = e.target
  160.       else if (e.srcElement) targ=e.srcElement
  161.       orderTd(targ)
  162.       drag = false
  163.       //put columns new order in hidden field
  164.       ColOrderField.value=colOrder;
  165.       for(x=0; x<linhas.length; x++) {
  166.           for (y=0; y<linhas[x].cells.length; y++) {
  167.           linhas[x].cells[y].style.borderLeftStyle=borderLeftStyle[x][y];
  168.           linhas[x].cells[y].style.borderLeftColor=borderLeftColor[x][y];
  169.           linhas[x].cells[y].style.backgroundColor=cellBackgroundColor[x][y];
  170.           linhas[x].cells[y].style.borderLeftWidth=borderLeftWidth[x][y];
  171.           }
  172.       }
  173.    }
  174.  
  175. }
  176.  
  177. function cellIndex(td) {
  178.     var ci = -1;
  179.     var parent_row = ascendDOM(td, 'tr');
  180.     for (var i = 0; i < parent_row.cells.length; i++) {
  181.         if (td === parent_row.cells[i]) {
  182.             ci = i;
  183.         }
  184.     }
  185.     return ci;
  186. }
  187.  
  188. function ascendDOM(e,target) {
  189.     while (e.nodeName.toLowerCase() !=target &&
  190.            e.nodeName.toLowerCase() !='html')
  191.         e=e.parentNode;
  192.     return (e.nodeName.toLowerCase() == 'html')? null : e;
  193. }
  194.  
  195.  
Mar 10 '07 #7
cdtkoenig
2 New Member
I forgot to write that you need to call following function to activate DD on table, example :
setTableColMova ble("my_table_i d","one_html_fi eld",[0,1,2,3]);

this call initiate table DD and also specify an HTML field (hidden by example) to store reordered columns numbers list. So initial column numbers are to be passed into last param (here [0,1,2,3]) in setTableColMova ble call

hope it's clear cause it is time to launch ;)
Mar 10 '07 #8
Romulo NF
54 New Member
Hello again folks!
I´ve received some emails about issues on the performance of the table (especially in ie) while working with big tables (30+ columns / 100+ lines) and i´ve worked a bit more into the script to improve it!

In the older version i was using classnames to give a visual effect of the column that is being moved and to where it was being moved, having to use some loops to change all classes and then change em back to the original afterwards! All those loops were causing an annoying delay!

There are still some changes to be done like: allowing more than 1 table in the same page to have the "drag & drop" implemented! I will work on that soon!

Email me with suggestions / issues so i can improve the script
I´ve tested it only under ie/firefox/mozilla/netscape, so some feedback from other browsers are welcome

call the script using:
allowDragging(t ableId)


file: movecolumn.js

Expand|Select|Wrap|Line Numbers
  1. //----------------------------------------------//
  2. //    Created by: Romulo do Nascimento Ferreira    //
  3. //    Email: romulo.nf@gmail.com                    //
  4. //----------------------------------------------//
  5. //
  6. // Drag & Drop Columns
  7. //
  8. // NOTICE: This code may be use to any purpose without further
  9. // permission from the author. You may remove this notice from the
  10. // final code, however its appreciated if you keep the author name/email
  11. // Email me if there´s something needing improvement
  12.  
  13. var drag = false;
  14. document.onmouseup = release;
  15. document.onmousemove = mouseCoords;
  16.  
  17. function allowDragging(tableId) {
  18. dragTable = document.getElementById(tableId)
  19.  
  20. dragTableHandler = dragTable.getElementsByTagName("thead")[0] ? dragTable.getElementsByTagName("thead")[0].getElementsByTagName("tr")[0].cells : dragTable.getElementsByTagName("tr") ? dragTable.getElementsByTagName("tr")[0].cells : null
  21.  
  22. maxIndex = dragTableHandler.length
  23.  
  24. tableRows = dragTable.getElementsByTagName("tr");
  25.  
  26.     for (x=0; x<dragTableHandler.length; x++) {
  27.     makeDraggable(dragTableHandler[x])
  28.     dragTableHandler[x].onselectstart = function() { return false; }
  29.     }
  30.  
  31. dragTable.onmouseup = release;
  32. }
  33.  
  34. function makeDraggable(obj) {
  35.     if(!obj) return;
  36.     obj.onmousedown = function(ev){
  37.         if (drag == true) return
  38.         captureColumnIndex(this);    
  39.         createDraggedColumn(this)
  40.         drag = true
  41.         return false;
  42.     }
  43. }
  44.  
  45. function release(e) {
  46.     if (drag == false) return
  47.     if (!e) e=window.event
  48.     if (e.target) targ = e.target
  49.     else if (e.srcElement) targ=e.srcElement
  50.     orderTd(targ)
  51.     drag = false
  52.  
  53.     if (document.getElementById("drag")) {
  54.     corpo = document.getElementsByTagName("body")[0];
  55.     remover = document.getElementById("drag");
  56.     corpo.removeChild(remover)
  57.     }
  58. }
  59.  
  60. function captureColumnIndex(obj) {
  61. columnIndex = obj.cellIndex
  62. return columnIndex
  63. }
  64.  
  65. function orderTd(obj) {
  66. newIndex = obj.cellIndex
  67.  
  68. if (newIndex == null) return
  69. if (columnIndex == newIndex) return
  70.  
  71.     for (x=0; x<tableRows.length; x++) {
  72.     tds = tableRows[x].cells
  73.     var cell = tableRows[x].removeChild(tds[columnIndex])
  74.         if (newIndex >= maxIndex || newIndex + 1 >= maxIndex) {
  75.         tableRows[x].appendChild(cell)
  76.         }
  77.         else {
  78.         tableRows[x].insertBefore(cell, tds[newIndex])
  79.         }
  80.     }
  81. }
  82.  
  83. function createDraggedColumn(obj) {
  84.  
  85. draggedTable = document.createElement("table");
  86. draggedTable.id = "drag"
  87.  
  88. draggedThead = document.createElement("thead");
  89. draggedTheadTr = document.createElement("tr");
  90. draggedTheadTd = document.createElement("td");
  91. draggedTheadTd.innerHTML = tableRows[0].cells[columnIndex].innerHTML
  92. draggedTheadTr.appendChild(draggedTheadTd)
  93. draggedThead.appendChild(draggedTheadTr)
  94. draggedTable.appendChild(draggedThead)
  95.  
  96. draggedTbody = document.createElement("tbody");    
  97.  
  98. for (x=1; x<tableRows.length; x++) {
  99.     draggedTr = document.createElement("tr");
  100.     draggedTd = document.createElement("td");
  101.     draggedTd.innerHTML = tableRows[x].cells[columnIndex].innerHTML
  102.     draggedTr.appendChild(draggedTd)
  103.     draggedTbody.appendChild(draggedTr)
  104. }
  105.  
  106. draggedTable.appendChild(draggedTbody)
  107. draggedTable.style.filter = "alpha(opacity=70)";
  108. draggedTable.style.opacity = "0.7"
  109. draggedTable.style.mozOpacity = "0.7"
  110.  
  111. document.getElementsByTagName("body")[0].appendChild(draggedTable)
  112. draggedTable.style.top = posY
  113. draggedTable.style.left = posX
  114. }
  115.  
  116. function mouseCoords(e) {
  117. if (!e) e = window.event
  118.  
  119. if(e.pageY) {posX=e.pageX; posY=e.pageY;}
  120.  
  121. else if (e.clientY) {posX=e.clientX + ietruebody().scrollLeft; posY=e.clientY + ietruebody().scrollTop;}
  122.  
  123.     if (document.getElementById("drag")) {
  124.     dragTable = document.getElementById("drag");
  125.     dragTable.style.top = posY + 3 + "px"
  126.     dragTable.style.left = posX + 7 + "px"
  127.     }
  128.  
  129. return {x:posX, y:posY}
  130. }
  131.  
  132. function ietruebody(){
  133. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  134. }
  135.  
Apr 17 '07 #9
Romulo NF
54 New Member
file: movecolumns.css

Expand|Select|Wrap|Line Numbers
  1. /* table general style */
  2. table {border-collapse:collapse}
  3. table td {border:1px solid #000; padding:2px 5px; text-align:center; cursor:pointer; font:bold 12px verdana;}
  4. table thead td {background:#1864E0; color:#fff;}
  5.  
  6. /* drag td style */
  7.  
  8. #drag {position:absolute; border:1px solid #000; text-align:center; cursor:pointer; font:bold 12px verdana; color:#fff;}
  9. #drag thead td {background:#1864E0; color:#fff;}
  10. #drag td {border:1px solid #000; padding:2px 5px; text-align:center; cursor:pointer; font:bold 12px verdana; color:#000}
  11.  
file: movecolumns.htm l

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2.  
  3. <html>
  4. <head>
  5.     <title>Drag and Drop Columns</title>
  6.  
  7. <script type="text/javascript" src="movecolumn.js"></script>
  8.  
  9. <link rel="StyleSheet" href="movecolumn.css" type="text/css" />
  10.  
  11. </head>
  12.  
  13. <body>
  14.  
  15. <table id="tabela">
  16.     <thead>
  17.         <tr>
  18.             <td>Column1</td>
  19.             <td>Column2</td>
  20.             <td>Column3</td>
  21.             <td>Column4</td>
  22.             <td>Column5</td>
  23.             <td>Column6</td>
  24.             <td>Column7</td>
  25.             <td>Column8</td>
  26.             <td>Column9</td>
  27.         </tr>
  28.     </thead>
  29.     <tbody>    
  30.         <tr>
  31.             <td>A1</td>
  32.             <td>A2</td>
  33.             <td>A3</td>
  34.             <td>A4</td>
  35.             <td>A5</td>
  36.             <td>A6</td>
  37.             <td>A7</td>
  38.             <td>A8</td>
  39.             <td>A9</td>            
  40.         </tr>
  41.         <tr>
  42.             <td>B1</td>
  43.             <td>B2</td>
  44.             <td>B3</td>
  45.             <td>B4</td>
  46.             <td>B5</td>
  47.             <td>B6</td>
  48.             <td>B7</td>
  49.             <td>B8</td>
  50.             <td>B9</td>            
  51.         </tr>
  52.         <tr>
  53.             <td>C1</td>
  54.             <td>C2</td>
  55.             <td>C3</td>
  56.             <td>C4</td>
  57.             <td>C5</td>
  58.             <td>C6</td>
  59.             <td>C7</td>
  60.             <td>C8</td>
  61.             <td>C9</td>            
  62.         </tr>
  63.         <tr>
  64.             <td>D1</td>
  65.             <td>D2</td>
  66.             <td>D3</td>
  67.             <td>D4</td>
  68.             <td>D5</td>
  69.             <td>D6</td>
  70.             <td>D7</td>
  71.             <td>D8</td>
  72.             <td>D9</td>            
  73.         </tr>
  74.         <tr>
  75.             <td>E1</td>
  76.             <td>E2</td>
  77.             <td>E3</td>
  78.             <td>E4</td>
  79.             <td>E5</td>
  80.             <td>E6</td>
  81.             <td>E7</td>
  82.             <td>E8</td>
  83.             <td>E9</td>            
  84.         </tr>
  85.         <tr>
  86.             <td>F1</td>
  87.             <td>F2</td>
  88.             <td>F3</td>
  89.             <td>F4</td>
  90.             <td>F5</td>
  91.             <td>F6</td>
  92.             <td>F7</td>
  93.             <td>F8</td>
  94.             <td>F9</td>            
  95.         </tr>        
  96.     </tbody>
  97. </table>
  98.  
  99. <script>
  100. allowDragging("tabela")
  101. </script>
  102.  
  103. </body>
  104.  
  105. </html>
  106.  
  107.  

ps: for some reason i couldnt put everything in 1 post
Apr 17 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4161
by: srikanth | last post by:
Hi all, I have an requirement in one of my projects. We have one aspx page, in that we have two frames, in each frame having a tree structure control(dynamic data). In the left Frame we are displaying all the documentcollections(dynamic) in the Treestructure, In the Right side we are displaying all the HolderGroups (dynamic).We have to assing Any one of the Documentcollections to HolderGroups, through Drag and Drop
1
7621
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to my own WinForm app. Unfortunately it doesn't work. In the "drop event" are eight DataFormats (e.Data.GetFormats()) but the important one (imho) "FileContents" is "Nothing"/"null".
2
9188
by: Grey | last post by:
I need to design a workflow application with C#. I want to design an UI with some workflow components which they can be drag & drop anywhere in order to design the workflow for the application users. Moreover, when the user double click on the component, they can define some routing rules for the process. Is it possible to have such fancy UI in C#?? Any reference sites or tutorial?? Million Thanks.
2
2793
by: Ivo Tcholakov | last post by:
Is it possible to drag and drop controls in an aspx page at runtime ? Meaning i have developed a ASP.NET web form, the web form is now downloaded in IE - now can i have this form to detect mouse events, and provide drag and drop functionality of the controls ? Thank You Ivo Tcholakov
3
3874
by: Goldwind | last post by:
Hi, I"m trying to use drag & drop of text from one text box to another but without suceess. Microsoft presented an example in "101 code samples" BUT in this example the code select and drag all the text in the TextBox, wether the user wants or not. I need to drag only the selected text (changing the example causes it not to work).
3
10585
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
11
1977
by: Greg P | last post by:
I'm using VB 2005, and have drug and dropped datagridviews onto my form. The default code that is generated for inserts tries to insert a value for the auto generated primary key. Below is the generated code. I put ***** around the problematic code. I've tried just removing this and it doesn't seem to work. There may be more generated code I don't know about. I could remove it but I am planning on doing a lot of refreshing of the data...
0
8444
by: Romulo NF | last post by:
I´ve recently posted a script to move columns from a table using drag and drop javascript. Recently i´ve received a message of a user of this communty showing interest in the script to move lines instead of columns. This post will present the script for you guys. file: moverows.css table {border-collapse:collapse; cursor:pointer} td {width:30px; padding:5px; text-align:center; font:bold 14px verdana; color:#000; border:1px solid #000}...
5
13762
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you guys can easier understand it engine. What exactly we need when trying to make a column drag &...
0
8197
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8287
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.