Update row after sort of search

Update row after sort of search

danirubdanirub Posts: 1Questions: 1Answers: 0

Hello to all.
I have in a row a button that when click it opens a model to update the row.
All is ok but the problem starts when the user dies sort or search.
then the rowIndex changes.

$('#employee-grid ').on( 'click', '.dt-ch', function () {
 

 
           var rowid = $(this).closest('tr').index();
            var data = table.row( $(this).parents('tr') ).data();
 console.log(rowid)
   
 });

I get the index row after the sort or search.
How can I get the original indexed row?
Thanks Dani

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @danirub ,

    If you use row().index(), that will be constant for that row. See the example here. The index() you were calling before was for jQuery, which is just the physical position in the table as you said.

    Cheers,

    Colin

This discussion has been closed.