checkbox is unchecked to delete that row

checkbox is unchecked to delete that row

cheikhsadbouhcheikhsadbouh Posts: 1Questions: 1Answers: 0
edited November 2017 in Free community support

i want when checkbox is unchecked to delete that row it's work fine , but i got some error

this is my code :
saleTB.rows().every(function (rowIdx, tableLoop, rowLoop) {
var data = this.data();

                  if(data != '') {
                      if (data[0] == tb[0]) {
                          console.log('   row data  :' + data + "       row index : " + rowIdx);
                          console.log('   col[0]  :' + data[0]);
                          saleTB.row(rowIdx)
                              .remove()
                              .draw();

                          console.log('  removed row data  :' + data);
                          console.log(' removed row idex :' + rowIdx);

                      } else {
                          // i=1;
                      }
                  }
              // ... do something with data(), or this.node(), etc
          });

error :
Uncaught TypeError: Cannot read property '0' of undefined

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    Answer ✓

    Without seeing the code in action this is just a guess:

    if (data[0] == tb[0]) {

    I'm guessing the problem is with tb[0]. Where is it defined?

    Kevin

This discussion has been closed.