Selaa lähdekoodia

subtree limit alpha

Ivan Asmer 8 vuotta sitten
vanhempi
commit
bc8cbf2a47
1 muutettua tiedostoa jossa 13 lisäystä ja 7 poistoa
  1. 13 7
      static/index.js

+ 13 - 7
static/index.js

@@ -55,19 +55,25 @@ setTimeout(function(){
 
 //    $s.textarea; $s.select; $s.dzen; $s.check1; $s.note; $s.married; //just for init
     function btnDel(){
+        var arr = $s.hashTable.slice();
         var thisLine = this.parentElement.parentElement;
-        thisLine.remove();
-        $s["#hashTable tr:first-child button"] = false; //turn off first button of deletion
+        arr.splice(thisLine.rowIndex,1)
+        $s.hashTable = arr;
         document.onchange();
     };
     $s.btnDel = {onclick: btnDel};
 
     $s.addPerson = {onclick: function(){
-        var newLine = document.getElementById('hashTable').copy.children[0].cloneNode(true);
-        newLine.nbData = Object.assign({},persons[0]);
-        document.getElementById('hashTable').appendChild(newLine);
-        $s.btnDel = {onclick: btnDel};
-        document.onchange();
+        var arr = $s.hashTable.slice();
+        arr.push(Object.assing({},arr[0]))
+        $s.hashTable = arr;
+            
+        
+        //var newLine = document.getElementById('hashTable').copy.children[0].cloneNode(true);
+        //newLine.nbData = Object.assign({},persons[0]);
+        //document.getElementById('hashTable').appendChild(newLine);
+        //$s.btnDel = {onclick: btnDel};
+        //document.onchange();
     }}
 
     var ediNumbers = [];