All pastes #17602 Raw Edit

Unnamed

public text v1 · immutable
#17602 ·published 2005-07-13 08:36 UTC
rendered paste body
    // zamieniane wierszy miejscami, bez uwagi na to czy jest to wiersz produktu czy etykieta
    function moveRow(o,direction){
      sourceRowIndex = o.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex;
      if(sourceRowIndex == 0) sourceRowIndex = o.parentNode.parentNode.rowIndex;
      
      // przepisujemy sobie wszystkie komorki z przenoszonego wiersza do tablicy
      sourceCells = document.getElementById('tabela_produktow').rows[sourceRowIndex].cells;
      sourceCellsContent = new Array();
      for(i=0;i<sourceCells.length;i++) { 
        sourceCellsContent[i] = sourceCells[i].innerHTML; 
      }
      // kasujemy przenoszony wiersz
      document.getElementById('tabela_produktow').deleteRow(sourceRowIndex);
      
      newRow = document.getElementById('tabela_produktow').insertRow(sourceRowIndex+1);
      for(i=0;i<sourceCellsContent.length;i++) {
        newCell = newRow.insertCell(i);
        newCell.innerHTML = sourceCellsContent[i];
      }
      if(sourceCellsContent.length==2){
        newCell.colSpan = 10;
      }
      
      
       
      rowsNo = document.getElementById('tabela_produktow').rows.length;
      //alert(sourceRowIndex + "__" + rowsNo);


    }