RowIndex after sort

RowIndex after sort

ghostrider7aughostrider7au Posts: 1Questions: 1Answers: 0

I've struggled for a few days and can't find any solution on the net for this so thought I'd kindly ask...
After sorting I find the rowIndex that points to other cells (on the same row) has changed. For example I have a text input that when clicked on updates another cell in the Datatable. After sorting however when I click on it, it starts editing a different cell (row) even though I am requesting the rowIndex again. Here is an example: https://jsfiddle.net/3qgwcLmn/
Click on the input cell, sort the column then click on the input cell again. How do I get the rowIndex (updated one after sort) when clicking on the text input? Thank you.

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    I'm not sure I understand the problem.
    The rowIndex refers to the position of the row on the page. Naturally it will change when the page is sorted.
    You have hard-coded a "3"

    table.cell(index, 3).data('not 41').draw();
    

    when what you really need is the new (post-sort) row reference.

This discussion has been closed.