Table - Columns drag & drop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Romulo NF
    New Member
    • Nov 2006
    • 54

    Table - Columns drag & drop

    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

    Code:
    /* estilo geral da tabela */
    table {border-collapse:collapse}
    table td {border:1px solid #000; padding:2px 5px; text-align:center; cursor:pointer}
    
    /* classe das cores utilizadas na movimentação */
    .hover {background:lightblue}
    .selecionado {background:lightgreen}
    file:movecolumn s.js

    [code=javascript]
    //----------------------------------------------//
    // Created by: Romulo do Nascimento Ferreira //
    // Email: romulo.nf@gmail .com //
    //----------------------------------------------//

    // NOTICE: This code may be use dto any purpose without further
    // permission from the author. You may remove this notice from the
    // final code, however its appreciated if you keep the author name/email.
    // Email me if theres something needing improvement

    //set the id of the table that is gonna have the
    //moving column function in the tabelaDrag variable
    document.onmous eup = soltar;
    var drag = false;

    window.onload = init

    function init() {
    tabelaDrag = document.getEle mentById("tabel a");
    linhas = tabelaDrag.getE lementsByTagNam e("TR");
    celulas = tabelaDrag.getE lementsByTagNam e("TD");
    linhaUm = tabelaDrag.rows[0]
    ordenacaoMaxima = linhaUm.cells.l ength

    tabelaDrag.onse lectstart = function () { return false; }
    tabelaDrag.onmo usedown = function () { return false; }

    for (x=0; x<celulas.lengt h;x++) {
    arrastar(celula s[x])
    celulas[x].onmouseover = pintar
    celulas[x].onmouseout = pintar
    }
    }

    function capturarColuna( obj) {
    coluna = obj.cellIndex
    return coluna
    }

    function orderTd (obj) {
    destino = obj.cellIndex

    if (destino == null) return
    if (coluna == destino) return

    for (x=0; x<linhas.length ; x++) {
    tds = linhas[x].cells
    var celula = linhas[x].removeChild(td s[coluna])
    if (destino >= ordenacaoMaxima || destino + 1 >= ordenacaoMaxima ) {
    linhas[x].appendChild(ce lula)
    }
    else {
    linhas[x].insertBefore(c elula, tds[destino])
    }
    }
    }

    function soltar(e){
    if (!e) e=window.event
    if (e.target) targ = e.target
    else if (e.srcElement) targ=e.srcEleme nt
    orderTd(targ)
    drag = false

    for(x=0; x<linhas.length ; x++) {
    for (y=0; y<linhas[x].cells.length; y++) {
    linhas[x].cells[y].className="";
    }
    }
    }

    function arrastar(obj){
    if(!obj) return;
    obj.onmousedown = function(ev){
    colunaAtual = this.cellIndex
    for (x=0; x<linhas.length ; x++) {
    linhas[x].cells[this.cellIndex].className="sel ecionado"
    }
    drag = true
    capturarColuna( this);
    return false;
    }
    }

    function pintar(e) {
    if (!e) e=window.event
    ev = e.type

    if (ev == "mouseover" ) {
    if (drag) {
    for (x=0; x<linhas.length ; x++) {
    if (this.className !="selecionado" ) {
    linhas[x].cells[this.cellIndex].className="hov er"
    }
    }
    }
    }

    else if (ev == "mouseout") {
    for (x=0; x<linhas.length ; x++) {
    if (this.className !="selecionado" ) {
    linhas[x].cells[this.cellIndex].className=""
    }
    }
    }
    }

    [/code]

    file:movecolumn s.html

    [code=html]
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
    <title>Drag and Drop Columns</title>

    <script type="text/javascript" src="movecolumn .js"></script>

    <link rel="StyleSheet " href="movecolum n.css" type="text/css" />

    </head>

    <body>

    <table id="tabela">
    <tr>
    <td>Coluna 1</td>
    <td>Coluna 2</td>
    <td>Coluna 3</td>
    <td>Coluna 4</td>
    <td>Coluna 5</td>
    <td>Coluna 6</td>
    <td>Coluna 7</td>
    <td>Coluna 8</td>
    <td>Coluna 9</td>
    <td>Coluna 10</td>
    </tr>
    <tr>
    <td>A1</td>
    <td>A2</td>
    <td>A3</td>
    <td>A4</td>
    <td>A5</td>
    <td>A6</td>
    <td>A7</td>
    <td>A8</td>
    <td>A9</td>
    <td>A10</td>
    </tr>
    <tr>
    <td>B1</td>
    <td>B2</td>
    <td>B3</td>
    <td>B4</td>
    <td>B5</td>
    <td>B6</td>
    <td>B7</td>
    <td>B8</td>
    <td>B9</td>
    <td>B10</td>
    </tr>
    <tr>
    <td>C1</td>
    <td>C2</td>
    <td>C3</td>
    <td>C4</td>
    <td>C5</td>
    <td>C6</td>
    <td>C7</td>
    <td>C8</td>
    <td>C9</td>
    <td>C10</td>
    </tr>

    </table>

    </body>

    </html>
    [/code]
    Last edited by gits; Nov 13 '07, 08:37 PM. Reason: added code identifiers
  • abducted
    New Member
    • Sep 2006
    • 8

    #2
    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.

    Comment

    • archrajan
      New Member
      • Dec 2006
      • 2

      #3
      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.

      Comment

      • Romulo NF
        New Member
        • Nov 2006
        • 54

        #4
        Originally posted by archrajan
        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!

        Comment

        • chillAtGVC
          New Member
          • Feb 2007
          • 1

          #5
          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:

          Code:
          function cellIndex(td) {
              var ci = -1;
              var parent_row = ascendDOM(td, 'tr');
              for (var i = 0; i < parent_row.cells.length; i++) {
                  if (td === parent_row.cells[i]) {
                      ci = i;
                  }
              }
              return ci;
          }
          
          function ascendDOM(e,target) {
              while (e.nodeName.toLowerCase() !=target &&
                     e.nodeName.toLowerCase() !='html')
                  e=e.parentNode;
              return (e.nodeName.toLowerCase() == 'html')? null : e;
          }

          Comment

          • abducted
            New Member
            • Sep 2006
            • 8

            #6
            Thanks for the fix.

            Comment

            • cdtkoenig
              New Member
              • Mar 2007
              • 2

              #7
              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 ;)

              [CODE=javascript]
              //----------------------------------------------//
              // Created by: Romulo do Nascimento Ferreira //
              // Email: romulo.nf@gmail .com //
              //----------------------------------------------//

              // NOTICE: This code may be use dto any purpose without further
              // permission from the author. You may remove this notice from the
              // final code, however its appreciated if you keep the author name/email.
              // Email me if theres something needing improvement


              var drag = false;
              var colOrder=[];
              var borderLeftStyle =[];
              var borderLeftColor =[];
              var cellBackgroundC olor=[];
              var borderLeftWidth =[];
              var colNames=[];

              function setTableColMova ble(tableName,C olOrderFieldNam e,colNames) {
              tabelaDrag = document.getEle mentById(tableN ame);
              ColOrderField = document.getEle mentById(ColOrd erFieldName);
              linhas = tabelaDrag.getE lementsByTagNam e("TR");
              celulas = tabelaDrag.getE lementsByTagNam e("TD");
              linhaUm = tabelaDrag.rows[0]
              ordenacaoMaxima = linhaUm.cells.l ength

              //store columns order
              for (x=0;x<linhaUm. cells.length;x+ +)
              {
              arrastar(celula s[x]);
              celulas[x].onselectstart = function () { return false; } //prevent text selection
              celulas[x].onmouseover = pintar
              celulas[x].onmouseout = pintar
              celulas[x].onmouseup = pintar
              colOrder[x]=colNames[x];
              linhaUm.cells[x].style.cursor=" pointer";
              }

              //store cells styles
              for(x=0; x<linhas.length ; x++) {
              borderLeftStyle[x]=[];
              borderLeftColor[x]=[];
              cellBackgroundC olor[x]=[];
              borderLeftWidth[x]=[];
              for (y=0; y<linhas[x].cells.length; y++) {
              borderLeftStyle[x][y]=linhas[x].cells[y].style.borderLe ftStyle;
              borderLeftColor[x][y]=linhas[x].cells[y].style.borderLe ftColor;
              cellBackgroundC olor[x][y]=linhas[x].cells[y].style.backgrou ndColor;
              borderLeftWidth[x][y]=linhas[x].cells[y].style.borderLe ftWidth;
              }
              }
              }

              function getColOrder()
              {
              return colOrder
              }

              function moveArrayCol(my Array,source,de stination)
              {
              val=myArray.spl ice(source,1);
              if (source < destination)
              {myArray.splice (destination-1,0,val);}
              else
              {myArray.splice (destination,0, val);}
              return myArray
              }

              function capturarColuna( obj) {
              coluna = cellIndex(obj)
              return coluna
              }

              function orderTd (obj) {
              destino = cellIndex(obj)
              if (destino == null) return
              if (coluna == destino) return

              for (x=0; x<linhas.length ; x++)
              {
              tds = linhas[x].cells
              var celula = linhas[x].removeChild(td s[coluna])
              if (coluna < destino)
              {
              linhas[x].insertBefore(c elula, tds[destino-1])
              }
              else
              {
              linhas[x].insertBefore(c elula, tds[destino])
              }
              }
              moveArrayCol(co lOrder,coluna,d estino);
              //alert(colOrder) ;
              }

              function soltar(e){
              if (!e) e=window.event
              if (e.target) targ = e.target
              else if (e.srcElement) targ=e.srcEleme nt
              orderTd(targ)
              drag = false

              for(x=0; x<linhas.length ; x++) {
              for (y=0; y<linhas[x].cells.length; y++) {
              linhas[x].cells[y].style.borderLe ftStyle=borderL eftStyle[x][y];
              linhas[x].cells[y].style.borderLe ftColor=borderL eftColor[x][y];
              linhas[x].cells[y].style.backgrou ndColor=cellBac kgroundColor[x][y];
              linhas[x].cells[y].style.borderLe ftWidth=borderL eftWidth[x][y];
              }
              }
              }

              function arrastar(obj){
              if(!obj) return;
              obj.onmousedown = function(ev){
              //colunaAtual = cellIndex(this) )
              for (x=0; x<linhas.length ; x++) {
              linhas[x].cells[cellIndex(this)].style.backgrou ndColor="yellow "
              }
              drag = true
              capturarColuna( this);
              return false;
              }
              }

              function pintar(e) {
              if (!e) e=window.event
              ev = e.type

              if (ev == "mouseover" ) {
              if (drag) {
              for (x=0; x<linhas.length ; x++) {
              if (cellIndex(this ) !=coluna) { //(this.style.bor derStyle !="dashed") {
              linhas[x].cells[cellIndex(this)].style.borderLe ftStyle="solid" ;
              linhas[x].cells[cellIndex(this)].style.borderLe ftColor="red";
              linhas[x].cells[cellIndex(this)].style.borderLe ftWidth="2px";
              }
              }
              }
              }

              else if (ev == "mouseout") {
              if (drag)
              {for (x=0; x<linhas.length ; x++)
              {if (cellIndex(this ) !=coluna) //(this.borderSty le !="dashed")
              {
              linhas[x].cells[cellIndex(this)].style.borderLe ftStyle=borderL eftStyle[x] [cellIndex(this)];
              linhas[x].cells[cellIndex(this)].style.borderLe ftColor=borderL eftColor[x] [cellIndex(this)];
              linhas[x].cells[cellIndex(this)].style.backgrou ndColor=cellBac kgroundColor[x] [cellIndex(this)];
              linhas[x].cells[cellIndex(this)].style.borderLe ftWidth=borderL eftWidth[x] [cellIndex(this)];
              }
              }
              }
              }


              else if (ev == "mouseup") {
              if (e.target) targ = e.target
              else if (e.srcElement) targ=e.srcEleme nt
              orderTd(targ)
              drag = false
              //put columns new order in hidden field
              ColOrderField.v alue=colOrder;
              for(x=0; x<linhas.length ; x++) {
              for (y=0; y<linhas[x].cells.length; y++) {
              linhas[x].cells[y].style.borderLe ftStyle=borderL eftStyle[x][y];
              linhas[x].cells[y].style.borderLe ftColor=borderL eftColor[x][y];
              linhas[x].cells[y].style.backgrou ndColor=cellBac kgroundColor[x][y];
              linhas[x].cells[y].style.borderLe ftWidth=borderL eftWidth[x][y];
              }
              }
              }

              }

              function cellIndex(td) {
              var ci = -1;
              var parent_row = ascendDOM(td, 'tr');
              for (var i = 0; i < parent_row.cell s.length; i++) {
              if (td === parent_row.cell s[i]) {
              ci = i;
              }
              }
              return ci;
              }

              function ascendDOM(e,tar get) {
              while (e.nodeName.toL owerCase() !=target &&
              e.nodeName.toLo werCase() !='html')
              e=e.parentNode;
              return (e.nodeName.toL owerCase() == 'html')? null : e;
              }

              [/CODE]
              Last edited by gits; Nov 13 '07, 08:38 PM. Reason: added code identifiers

              Comment

              • cdtkoenig
                New Member
                • Mar 2007
                • 2

                #8
                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 ;)

                Comment

                • Romulo NF
                  New Member
                  • Nov 2006
                  • 54

                  #9
                  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

                  [CODE=javascript]
                  //----------------------------------------------//
                  // Created by: Romulo do Nascimento Ferreira //
                  // Email: romulo.nf@gmail .com //
                  //----------------------------------------------//
                  //
                  // Drag & Drop Columns
                  //
                  // NOTICE: This code may be use to any purpose without further
                  // permission from the author. You may remove this notice from the
                  // final code, however its appreciated if you keep the author name/email
                  // Email me if there´s something needing improvement

                  var drag = false;
                  document.onmous eup = release;
                  document.onmous emove = mouseCoords;

                  function allowDragging(t ableId) {
                  dragTable = document.getEle mentById(tableI d)

                  dragTableHandle r = dragTable.getEl ementsByTagName ("thead")[0] ? dragTable.getEl ementsByTagName ("thead")[0].getElementsByT agName("tr")[0].cells : dragTable.getEl ementsByTagName ("tr") ? dragTable.getEl ementsByTagName ("tr")[0].cells : null

                  maxIndex = dragTableHandle r.length

                  tableRows = dragTable.getEl ementsByTagName ("tr");

                  for (x=0; x<dragTableHand ler.length; x++) {
                  makeDraggable(d ragTableHandler[x])
                  dragTableHandle r[x].onselectstart = function() { return false; }
                  }

                  dragTable.onmou seup = release;
                  }

                  function makeDraggable(o bj) {
                  if(!obj) return;
                  obj.onmousedown = function(ev){
                  if (drag == true) return
                  captureColumnIn dex(this);
                  createDraggedCo lumn(this)
                  drag = true
                  return false;
                  }
                  }

                  function release(e) {
                  if (drag == false) return
                  if (!e) e=window.event
                  if (e.target) targ = e.target
                  else if (e.srcElement) targ=e.srcEleme nt
                  orderTd(targ)
                  drag = false

                  if (document.getEl ementById("drag ")) {
                  corpo = document.getEle mentsByTagName( "body")[0];
                  remover = document.getEle mentById("drag" );
                  corpo.removeChi ld(remover)
                  }
                  }

                  function captureColumnIn dex(obj) {
                  columnIndex = obj.cellIndex
                  return columnIndex
                  }

                  function orderTd(obj) {
                  newIndex = obj.cellIndex

                  if (newIndex == null) return
                  if (columnIndex == newIndex) return

                  for (x=0; x<tableRows.len gth; x++) {
                  tds = tableRows[x].cells
                  var cell = tableRows[x].removeChild(td s[columnIndex])
                  if (newIndex >= maxIndex || newIndex + 1 >= maxIndex) {
                  tableRows[x].appendChild(ce ll)
                  }
                  else {
                  tableRows[x].insertBefore(c ell, tds[newIndex])
                  }
                  }
                  }

                  function createDraggedCo lumn(obj) {

                  draggedTable = document.create Element("table" );
                  draggedTable.id = "drag"

                  draggedThead = document.create Element("thead" );
                  draggedTheadTr = document.create Element("tr");
                  draggedTheadTd = document.create Element("td");
                  draggedTheadTd. innerHTML = tableRows[0].cells[columnIndex].innerHTML
                  draggedTheadTr. appendChild(dra ggedTheadTd)
                  draggedThead.ap pendChild(dragg edTheadTr)
                  draggedTable.ap pendChild(dragg edThead)

                  draggedTbody = document.create Element("tbody" );

                  for (x=1; x<tableRows.len gth; x++) {
                  draggedTr = document.create Element("tr");
                  draggedTd = document.create Element("td");
                  draggedTd.inner HTML = tableRows[x].cells[columnIndex].innerHTML
                  draggedTr.appen dChild(draggedT d)
                  draggedTbody.ap pendChild(dragg edTr)
                  }

                  draggedTable.ap pendChild(dragg edTbody)
                  draggedTable.st yle.filter = "alpha(opacity= 70)";
                  draggedTable.st yle.opacity = "0.7"
                  draggedTable.st yle.mozOpacity = "0.7"

                  document.getEle mentsByTagName( "body")[0].appendChild(dr aggedTable)
                  draggedTable.st yle.top = posY
                  draggedTable.st yle.left = posX
                  }

                  function mouseCoords(e) {
                  if (!e) e = window.event

                  if(e.pageY) {posX=e.pageX; posY=e.pageY;}

                  else if (e.clientY) {posX=e.clientX + ietruebody().sc rollLeft; posY=e.clientY + ietruebody().sc rollTop;}

                  if (document.getEl ementById("drag ")) {
                  dragTable = document.getEle mentById("drag" );
                  dragTable.style .top = posY + 3 + "px"
                  dragTable.style .left = posX + 7 + "px"
                  }

                  return {x:posX, y:posY}
                  }

                  function ietruebody(){
                  return (document.compa tMode && document.compat Mode!="BackComp at")? document.docume ntElement : document.body
                  }
                  [/CODE]
                  Last edited by gits; Nov 13 '07, 08:38 PM. Reason: added code identifiers

                  Comment

                  • Romulo NF
                    New Member
                    • Nov 2006
                    • 54

                    #10
                    file: movecolumns.css

                    Code:
                    /* table general style */
                    table {border-collapse:collapse}
                    table td {border:1px solid #000; padding:2px 5px; text-align:center; cursor:pointer; font:bold 12px verdana;}
                    table thead td {background:#1864E0; color:#fff;}
                    
                    /* drag td style */
                    
                    #drag {position:absolute; border:1px solid #000; text-align:center; cursor:pointer; font:bold 12px verdana; color:#fff;}
                    #drag thead td {background:#1864E0; color:#fff;}
                    #drag td {border:1px solid #000; padding:2px 5px; text-align:center; cursor:pointer; font:bold 12px verdana; color:#000}
                    file: movecolumns.htm l

                    [code=html]
                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

                    <html>
                    <head>
                    <title>Drag and Drop Columns</title>

                    <script type="text/javascript" src="movecolumn .js"></script>

                    <link rel="StyleSheet " href="movecolum n.css" type="text/css" />

                    </head>

                    <body>

                    <table id="tabela">
                    <thead>
                    <tr>
                    <td>Column1</td>
                    <td>Column2</td>
                    <td>Column3</td>
                    <td>Column4</td>
                    <td>Column5</td>
                    <td>Column6</td>
                    <td>Column7</td>
                    <td>Column8</td>
                    <td>Column9</td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                    <td>A1</td>
                    <td>A2</td>
                    <td>A3</td>
                    <td>A4</td>
                    <td>A5</td>
                    <td>A6</td>
                    <td>A7</td>
                    <td>A8</td>
                    <td>A9</td>
                    </tr>
                    <tr>
                    <td>B1</td>
                    <td>B2</td>
                    <td>B3</td>
                    <td>B4</td>
                    <td>B5</td>
                    <td>B6</td>
                    <td>B7</td>
                    <td>B8</td>
                    <td>B9</td>
                    </tr>
                    <tr>
                    <td>C1</td>
                    <td>C2</td>
                    <td>C3</td>
                    <td>C4</td>
                    <td>C5</td>
                    <td>C6</td>
                    <td>C7</td>
                    <td>C8</td>
                    <td>C9</td>
                    </tr>
                    <tr>
                    <td>D1</td>
                    <td>D2</td>
                    <td>D3</td>
                    <td>D4</td>
                    <td>D5</td>
                    <td>D6</td>
                    <td>D7</td>
                    <td>D8</td>
                    <td>D9</td>
                    </tr>
                    <tr>
                    <td>E1</td>
                    <td>E2</td>
                    <td>E3</td>
                    <td>E4</td>
                    <td>E5</td>
                    <td>E6</td>
                    <td>E7</td>
                    <td>E8</td>
                    <td>E9</td>
                    </tr>
                    <tr>
                    <td>F1</td>
                    <td>F2</td>
                    <td>F3</td>
                    <td>F4</td>
                    <td>F5</td>
                    <td>F6</td>
                    <td>F7</td>
                    <td>F8</td>
                    <td>F9</td>
                    </tr>
                    </tbody>
                    </table>

                    <script>
                    allowDragging(" tabela")
                    </script>

                    </body>

                    </html>

                    [/code]


                    ps: for some reason i couldnt put everything in 1 post
                    Last edited by gits; Nov 13 '07, 08:39 PM. Reason: added code identifiers

                    Comment

                    • chami
                      New Member
                      • Dec 2007
                      • 1

                      #11
                      FOR YOUR NEXT MODIFICATION, CONSIDER FOLLWINGS

                      MORE THAN ONE TABLES DRAG AND DROP CAPABILITY
                      SHIFT COLUMN BETWEEN TABLES

                      CHAMI.
                      Last edited by gits; Dec 15 '07, 11:37 PM. Reason: removed quote

                      Comment

                      • drhowarddrfine
                        Recognized Expert Expert
                        • Sep 2006
                        • 7434

                        #12
                        It should be noted that there are problems with the html shown above.

                        1) The doctype is incomplete and will throw IE into 'quirks mode' making it not behave like modern browsers. The correct doctype is discussed under the html Howto and this is the correct one to use:
                        Code:
                        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
                           "http://www.w3.org/TR/html4/strict.dtd">
                        2) The <link> ends with a XHTML closing tag: /> . Since XHTML is not declared in the doctype, this may cause browsers to ignore some of the markup after it. (Perhaps causing the Safari problem?)

                        In any case, both of the items cause the page to be invalid.

                        Comment

                        • Romulo NF
                          New Member
                          • Nov 2006
                          • 54

                          #13
                          If you got into this topic consider looking my new column drag & drop script

                          Comment

                          • jigar1
                            New Member
                            • Feb 2009
                            • 2

                            #14
                            urgent Reply

                            Hello All,
                            I face 1 problem. this script working fine in both IE and mozilla
                            but i want to maintain the order of columns on page refresh so for that i set order in cookies and on page refresh i read that cookies order and pass that order in function but it return me our default order means in which order i have write my columns . can anyone plz help me.. my id is [email removed] . you can contact me here also.

                            Thanks in advance......

                            Comment

                            • jigar1
                              New Member
                              • Feb 2009
                              • 2

                              #15
                              need Help

                              Hello folks,
                              I face 1 problem. this script working fine in both IE and mozilla
                              but i want to maintain the order of columns on page refresh so for that i set order in cookies and on page refresh i read that cookies order and pass that order in function but it return me our default order means in which order i have write my columns . can anyone plz help me.. my id is [ removed email] . you can contact me here also. and i dont know your Email Id so can you plz tell me your email id.

                              Thanks in advance......
                              Last edited by acoder; Feb 16 '09, 09:23 AM. Reason: Removed email

                              Comment

                              Working...