delete row

delete row

jimjimjimjim Posts: 5Questions: 3Answers: 0

I've tried to search a table with the following code
var select = oTable4
.column( 0 ).search( '^'+inv_id+'$', true, false )
.column( 1 ).search( '^'+yl_id+'$', true, false ).draw();
var data = select.row(0);
And now i wand to delete a row found with editor like this
editor4
.remove( data, false )
.submit();
The searching is ok but the data for editor is not

Answers

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    Hi,

    I think the issue is with the data variable assignment. Two issues:

    • You want to pass Editor the row index so use row().index()
    • Just passing in 0 means select row data index 0. That is unlikely to be the row shown (although it is possible) - use the select ':eq(0)' to select the first visible row instead.
    var select = oTable4
      .column( 0 ).search( '^'+inv_id+'$', true, false )
      .column( 1 ).search( '^'+yl_id+'$', true, false )
      .draw();
    
    var data = select.row(':eq(0)').index();
    
    editor4 .remove( data, false ) .submit();
    

    Allan

This discussion has been closed.